Example #1
0
 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);
 }
Example #2
0
        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);
            }
        }