public override void Initialize(EntityExtensions extensions)
        {
            if (!RuleDebugger.CheckNoNotifyPropertyChangedWarning(extensions.Target))
            {
                return;
            }

            var r = new RecursionObject {
                Extensions = extensions, Strategy = this
            };

            // Wire notify property changed
            ((INotifyPropertyChanged)extensions.Target).PropertyChanged += r.OnPropertyChanged;

            // Wire notify collection changed
            foreach (var collection in GetCollections(extensions.Target))
            {
                if (RuleDebugger.CheckNoNotifyCollectionChangedWarning(collection))
                {
                    ((INotifyCollectionChanged)collection).CollectionChanged += r.OnCollectionChanged;
                }
            }

            // Set parent
            foreach (var childObject in GetAllChildObjects(extensions.Target))
            {
                childObject.Parent = extensions;
            }
        }
Beispiel #2
0
        protected virtual IEntityExtensions CreateExtensions()
        {
            var entityExtensions = EntityExtensions.RegisterObject(this);

            //entityExtensions.StartGraphMonitoring();
            return(entityExtensions);
        }
Beispiel #3
0
 internal void OnRuleAdded(EntityExtensions extension)
 {
     Extensions = extension;
     State      = RuleState.Added;
     if (_propertyDependency != null)
     {
         foreach (var propertyPath in _propertyDependency)
         {
             Extensions.AddPropertyDependency(this, propertyPath.One, propertyPath.Two);
         }
     }
 }
Beispiel #4
0
        public static IEntityExtensions RegisterObject(object target, IExtensionOptions initializer)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var entityExtensions = new EntityExtensions(target);

            entityExtensions.Initializer = initializer;

            return(entityExtensions);
        }
 public EntityWithoutBase()
 {
     Rules = EntityExtensions.RegisterTypedObject(this);
 }
 public virtual void Initialize(EntityExtensions extensions)
 {
 }
 protected virtual IEntityExtensions CreateExtensions()
 {
     return(EntityExtensions.RegisterObject(this));
 }
Beispiel #8
0
 internal RuleCollection(EntityExtensions extension, Action <Rule> decorator)
 {
     _extension = extension;
     _decorator = decorator;
 }