public void Advise(PropertyAdviceContext context) { if (_persistenceProperty == null) _persistenceProperty = new PropertyImporter<IPersistence>(context.TargetProperty.DeclaringType); var persistence = _persistenceProperty.Get(context.Target); if (context.IsGetter) context.ReturnValue = persistence.GetValue(Name, context.TargetProperty.PropertyType, DefaultValue); else persistence.SetValue(Name, context.Value, AutoSave); }
public void Advise(PropertyAdviceContext context) { if (_persistenceProperty == null) { _persistenceProperty = new PropertyImporter <IPersistence>(context.TargetProperty.DeclaringType); } var persistence = _persistenceProperty.Get(context.Target); if (context.IsGetter) { context.ReturnValue = persistence.GetValue(Name, context.TargetProperty.PropertyType, DefaultValue); } else { persistence.SetValue(Name, context.Value, AutoSave); } }