The PostSharp.Samples.Silverlight
contains three aspects that
can be applied on projects targeting Silverlight 2:
NotifyPropertyChangedAttribute
implements automatically the INotifyPropertyChanged
interface.OnWorkerThreadAttribute
executes a method in a worker thread instead of in the current thread.RequiredAttribute
validates that a field is not set to a null reference or an empty string.Aspects are defined in the project PostSharp.Samples.Silverlight.Aspects
and applied to the project
PostSharp.Samples.Silverlight.Test
. These projects reference the assemblies PostSharp.Public.SL.dll
and PostSharp.Laos.SL.dll
NotifyPropertyChangedAttribute
is the only non-trivial aspect. Since it requires code to be executed at
build time, it is implemented as an external aspect. Indeed, the NotifyPropertyChangedAttribute
class contains no
implementation. The aspect is implemented in another project, PostSharp.Samples.Silverlight.Impl
, which is not a
Silverlight class library but is linked to the full .NET Framework.