private IEntityChange <TEntity> getEntityChange(Entity <TEntity> context)
        {
            var propertyChanges           = getPropertyChanges(context);
            EntityChange <TEntity> change = new EntityChange <TEntity>(
                context.Instance,
                getState(context.State, propertyChanges),
                context.Data,
                propertyChanges);

            return(change);
        }
Esempio n. 2
0
        public IEntityChange <TDerived> As <TDerived>()
            where TDerived : class, TEntity
        {
            EntityChange <TDerived> change = new EntityChange <TDerived>(
                Entity as TDerived,
                State,
                Data,
                changes);

            return(change);
        }
        public IEntityChange <TEntity> DetectChanges(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            Entity <TEntity> context;

            if (lookup.TryGetValue(entity, out context))
            {
                return(getEntityChange(context));
            }
            else
            {
                EntityChange <TEntity> change = new EntityChange <TEntity>(
                    entity,
                    EntityState.Detached,
                    null,
                    new IPropertyChange[0]);
                return(change);
            }
        }