-
-
Notifications
You must be signed in to change notification settings - Fork 18
WeavingWithoutAddingAReference
Simon Cropp edited this page Jul 30, 2012
·
2 revisions
There are two types of avoiding a reference to PropertyChanging.dll
Assuming you added a reference to PropertyChanging.dll to get access to the notify attributes. The weaving task will remove all references to PropertyChanging.dll after your build. The resultant assembly will not need PropertyChanging.dll.
If you would prefer not to have any reference to PropertyChanging.dll, and you want to user the attribute approach to weaving you will need to implement your own attributes.
Note: Namespace, name and case is important. Not all attributes are required. See [Attributes] to work out what attributes you require.
namespace PropertyChanging
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public class AlsoNotifyForAttribute : Attribute
{
public AlsoNotifyForAttribute(string property){}
public AlsoNotifyForAttribute(string property, params string[] otherProperties){}
}
}
namespace PropertyChanging
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public class DoNotNotifyAttribute : Attribute
{
}
}
namespace PropertyChanging
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public class DependsOnAttribute : Attribute
{
public DependsOnAttribute(string dependency){}
public DependsOnAttribute(string dependency, params string[] otherDependencies){}
}
}
a