public void AddPersistenceData(AbstractSchemaPart e)
 {
     using (var unit = Hive.OpenWriter <IContentStore>())
     {
         unit.Repositories.Schemas.AddOrUpdate(e);
         unit.Complete();
     }
 }
Example #2
0
        public override void PerformAddOrUpdate(AbstractSchemaPart entity)
        {
            Mandate.ParameterNotNull(entity, "entity");

            if (!entity.Id.IsNullValueOrEmpty() && entity.Id.Value.Type != HiveIdValueTypes.Guid)
            {
                return;
            }

            // BUG: (APN 26/11) The Rdbms mapping code needs a context / scope object to track multiple maps of the same item during a single mapping operation.
            // For example, if a schema comes in to this method with 2x AttributeDefintions both referring to 1x NEW AttributeType, 2x AttributeTypes
            // will be saved because during the mapping operation the AttributeType had no id, and so a new one was created - but there's no way of tracking
            // that the AttributeType has now been "mapped" and is pending an Id, so on the second AttributeDefinition it would cause the AttributeType
            // to get mapped again.
            // For now, we'll split the entities into their consituent parts and call the normal save methods independently for AttributeTypes


            var allItems = entity.GetAllIdentifiableItems();

            List <AbstractSchemaPart> savedItems = new List <AbstractSchemaPart>();

            allItems.OfType <AttributeType>().ForEach(
                x =>
            {
                if (TryUpdateExisting(x))
                {
                    return;
                }
                Helper.MapAndMerge(x, FrameworkContext.TypeMappers);
                savedItems.Add(x);
            });

            // Do rest
            if (TryUpdateExisting(entity))
            {
                return;
            }
            Helper.MapAndMerge(entity, FrameworkContext.TypeMappers);
        }
 public HiveSchemaPostActionEventArgs(AbstractSchemaPart schemaPart, AbstractScopedCache scopedCache)
 {
     SchemaPart = schemaPart;
     ScopedCache = scopedCache;
 }
 public HiveSchemaPreActionEventArgs(AbstractSchemaPart schemaPart, AbstractScopedCache scopedCache)
     : base(scopedCache)
 {
     SchemaPart = schemaPart;
 }
Example #5
0
 public HiveSchemaPostActionEventArgs(AbstractSchemaPart schemaPart, AbstractScopedCache scopedCache)
 {
     SchemaPart  = schemaPart;
     ScopedCache = scopedCache;
 }
Example #6
0
 public override void PerformAddOrUpdate(AbstractSchemaPart entity)
 {
     _helper.CacheHelper.PerformAddOrUpdate(entity);
 }
Example #7
0
 public override void PerformAddOrUpdate(AbstractSchemaPart entity)
 {
     Helper.PerformAddOrUpdate(entity, ExamineTransaction);
 }
 public HiveSchemaPreActionEventArgs(AbstractSchemaPart schemaPart, AbstractScopedCache scopedCache)
     : base(scopedCache)
 {
     SchemaPart = schemaPart;
 }
 public void AddOrUpdate(AbstractSchemaPart entity)
 {
     ChildSessions.AddOrUpdate(entity, IdRoot);
 }
 public override void PerformAddOrUpdate(AbstractSchemaPart entity)
 {
     return;
 }