-
-
Notifications
You must be signed in to change notification settings - Fork 229
WeavingWithoutAddingAReference
Simon Cropp edited this page Jan 6, 2015
·
5 revisions
There are two types of avoiding a reference to PropertyChanged.dll
Assuming you added a reference to PropertyChanged.dll
to get access to the notify attributes. The weaving task will remove all references to PropertyChanged.dll
after your build. The resultant assembly will not need PropertyChanged.dll
.
If you would prefer not to have any reference to PropertyChanged.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 PropertyChanged
{
[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 PropertyChanged
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public class DoNotNotifyAttribute : Attribute
{
}
}
namespace PropertyChanged
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public class DependsOnAttribute : Attribute
{
public DependsOnAttribute(string dependency){}
public DependsOnAttribute(string dependency, params string[] otherDependencies){}
}
}
namespace PropertyChanged
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class DoNotCheckEqualityAttribute : Attribute
{
}
}