SharpCrafters Forum – OnMethodBoundaryAspect: Exclude property accessor weaving?

SharpCrafters Support Forum

        


OnMethodBoundaryAspect: Exclude property... Expand / Collapse
Author
Message
Posted 9/7/2009 10:44:55 AM


Community Member
Hi,

When declaring an OnMethodBoundaryAspect implementation - is it possible to exclude weaving of property accessors (get_ and set_)?

--
Post #2408
Posted 9/7/2009 10:54:59 AM


Gael Fraiteur

SharpCrafters
Yes, you can use:


MyAspect( AttributeExclude=true, AttributeTargetMembers="regex:get_|set_" AttributePriority=100)


Be sure to have AttributePriority lower than your "include" attribute.
Post #2409
Posted 9/7/2009 10:56:25 AM


Community Member
Excellent, thanks Gael.

--
Werner
Post #2410
Posted 9/7/2009 11:21:57 AM


Gael Fraiteur

SharpCrafters
You can also override CompileTimeValidate:


public override bool CompileTimeValidate(MethodBase method)
{
return !(method.Name.BeginsWith("set_") || method.Name.BeginsWith("get_"));
}

Post #2411
« Prev Topic | Next Topic »


All times are GMT +1:00, Time now is 2:27am

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.251. 9 queries. Compression Disabled.