Пример #1
0
        public IdentityMap Persist(object entity, object handler)
        {
            if (this.EnableParallelExecutionProperty)
            {
                throw new ArgumentException("Parallel execution is not supported by the Persist method.");
            }

            // Find all the handlers for the entity types
            this.RegisterEventHandlers(handler);

            var persistenceMap = new IdentityMap();

            if (typeof(IEnumerable).GetTypeInfo().IsInstanceOfType(entity))
            {
                this.PersistCollection(null, entity as IEnumerable, handler, persistenceMap);
            }
            else
            {
                this.PersistEntity(null, entity, handler, persistenceMap);
            }

            return(persistenceMap);
        }