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;
            }
        }
Exemplo n.º 2
0
        protected virtual IEntityExtensions CreateExtensions()
        {
            var entityExtensions = EntityExtensions.RegisterObject(this);

            //entityExtensions.StartGraphMonitoring();
            return(entityExtensions);
        }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public EntityWithoutBase()
 {
     Rules = EntityExtensions.RegisterTypedObject(this);
 }
 public virtual void Initialize(EntityExtensions extensions)
 {
 }
Exemplo n.º 7
0
 protected virtual IEntityExtensions CreateExtensions()
 {
     return(EntityExtensions.RegisterObject(this));
 }
Exemplo n.º 8
0
 internal RuleCollection(EntityExtensions extension, Action <Rule> decorator)
 {
     _extension = extension;
     _decorator = decorator;
 }