Beispiel #1
0
        protected EntityConfiguration <TEntity> AddCollection <TElement>(Expression <Func <TEntity, ICollection <TElement> > > accessor, string displayName, IEqualityComparer <TElement> comparer = null)
        {
            PropertyInfo property = ChangeDetector.GetProperty(accessor);

            detector.AddCollection(property, displayName, comparer);
            return(this);
        }
Beispiel #2
0
        protected EntityConfiguration <TEntity> Add <TProp>(Expression <Func <TEntity, TProp> > accessor, IEqualityComparer <TProp> comparer = null)
        {
            var propertyInfo = ChangeDetector.GetProperty <TEntity, TProp>(accessor);

            detector.Add <TEntity, TProp>(propertyInfo, null, null, comparer);
            return(this);
        }
Beispiel #3
0
        protected EntityConfiguration <TEntity> Add <TProp>(Expression <Func <TEntity, TProp> > accessor, Func <TEntity, string> displayName, Func <TEntity, TProp, string> formatter, IEqualityComparer <TProp> comparer = null)
        {
            var propertyInfo = ChangeDetector.GetProperty <TEntity, TProp>(accessor);

            detector.Add(propertyInfo, displayName, formatter, comparer);
            return(this);
        }
Beispiel #4
0
        public IPropertyChange GetChange <TProp>(Expression <Func <TDerived, TProp> > accessor, TDerived original, TDerived updated)
        {
            PropertyInfo property         = ChangeDetector.GetProperty(accessor);
            Snapshot     originalSnapshot = detector.TakeSnapshot(original, property);
            Snapshot     updatedSnapshot  = detector.TakeSnapshot(updated, property);

            return(detector.GetChange(property, originalSnapshot, updatedSnapshot));
        }
Beispiel #5
0
        public bool HasChange <TProp>(Expression <Func <TEntity, TProp> > accessor, TEntity original, TEntity updated)
        {
            PropertyInfo property         = ChangeDetector.GetProperty(accessor);
            Snapshot     originalSnapshot = detector.TakeSnapshot(original, property);
            Snapshot     updatedSnapshot  = detector.TakeSnapshot(updated, property);

            return(detector.HasChange(property, originalSnapshot, updatedSnapshot));
        }
Beispiel #6
0
        private IPropertyChange getChange <TProp>(Expression <Func <TEntity, TProp> > accessor)
        {
            PropertyInfo property = ChangeDetector.GetProperty(accessor);

            if (property == null)
            {
                return(null);
            }
            return(changes.Where(c => c.Property == property).SingleOrDefault());
        }
Beispiel #7
0
 public DerivedEntityChangeDetector(ChangeDetector detector)
 {
     this.detector = detector;
 }
Beispiel #8
0
 private EntityConfiguration(ChangeDetector detector)
 {
     this.detector = detector;
 }
Beispiel #9
0
        internal ICollectionChange <TElement> GetCollectionChanges <TElement>(Expression <Func <TEntity, ICollection <TElement> > > accessor, CollectionSnapshotLookup original, TEntity updated, ElementState state)
        {
            PropertyInfo property = ChangeDetector.GetProperty(accessor);

            return(detector.GetCollectionChanges <TElement>(property, original, updated, state));
        }
Beispiel #10
0
 public EntityConfiguration()
 {
     this.detector = new ChangeDetector();
 }