Ejemplo n.º 1
0
        /// <summary>
        /// The persist updated item.
        /// </summary>
        /// <param name="entity">
        /// The entity.
        /// </param>
        protected override void PersistUpdatedItem(IEntityCollection entity)
        {
            ((Entity)entity).UpdatingEntity();

            var factory = new EntityCollectionFactory();
            var dto     = factory.BuildDto(entity);

            Database.Update(dto);

            entity.ResetDirtyProperties();
        }
        /// <summary>
        /// The persist updated item.
        /// </summary>
        /// <param name="entity">
        /// The entity.
        /// </param>
        protected override void PersistUpdatedItem(IEntityCollection entity)
        {
            ((Entity)entity).UpdatingEntity();

            var factory = new EntityCollectionFactory();
            var dto     = factory.BuildDto(entity);

            Database.Update(dto);

            entity.ResetDirtyProperties();
            RuntimeCache.ClearCacheItem(Cache.CacheKeys.GetEntityCacheKey <IEntityCollection>(entity.Key));
            RuntimeCache.ClearCacheItem(Cache.CacheKeys.GetEntityCacheKey <IEntityFilterGroup>(entity.Key));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The persist new item.
        /// </summary>
        /// <param name="entity">
        /// The entity.
        /// </param>
        protected override void PersistNewItem(IEntityCollection entity)
        {
            var query = entity.ParentKey == null
                            ? Querying.Query <IEntityCollection> .Builder.Where(x => x.ProviderKey == entity.ProviderKey && x.EntityTfKey == entity.EntityTfKey)
                            : Querying.Query <IEntityCollection> .Builder.Where(x => x.ParentKey == entity.ParentKey);

            var sortOrder = this.Count(query);

            ((EntityCollection)entity).SortOrder = sortOrder;

            ((Entity)entity).AddingEntity();

            var factory = new EntityCollectionFactory();
            var dto     = factory.BuildDto(entity);

            Database.Insert(dto);
            entity.Key = dto.Key;
            entity.ResetDirtyProperties();
        }