Пример #1
0
        public async Task AddProperty(Guid id, [FromBody] AddProperty model)
        {
            var value = await _metaDbContext.DomainEvents.Include(e => e.Properties).SingleAsync(e => e.Id == id);

            value.Properties.Add(new Property
            {
                Name         = model.Name,
                Description  = model.Description,
                IsCollection = model.IsCollection,
                SystemType   = model.SystemType,
                ValueTypeId  = model.ValueTypeId
            });
            await _metaDbContext.SaveChangesAsync();
        }
Пример #2
0
        public async Task <ValueObject> Create([FromBody] CreateType model)
        {
            var value = await _metaDbContext.ValueObjects.AddAsync(new Domain.Meta.ValueObject()
            {
                Id          = Guid.NewGuid(),
                ModuleId    = model.ModuleId,
                Name        = model.Name,
                Description = model.Description
            });

            await _metaDbContext.SaveChangesAsync();

            return(_mapper.Map <ValueObject>(value.Entity));
        }
        public async Task HandleAsync(AggregateDomainEventAdded @event)
        {
            _db.DomainEvents.Add(new DomainEvent
            {
                ParentId = @event.AggregateRootId,
                Name     = @event.Name
            });

            await _db.SaveChangesAsync();
        }
Пример #4
0
        public async Task HandleAsync(ValueObjectRegistered @event)
        {
            _db.ValueObjects.Add(new ValueObject
            {
                BoundedContextId = @event.BoundedContextId,
                MetaTypeId       = @event.AggregateRootId,
                Name             = @event.Name
            });

            await _db.SaveChangesAsync();
        }
        public async Task HandleAsync(MetaTypePropertyAdded @event)
        {
            _db.Properties.Add(new Property
            {
                ParentId   = @event.AggregateRootId,
                Name       = @event.Property.Name,
                MetaTypeId = @event.Property.Type.MetaTypeId,
                SystemType = @event.Property.Type.SystemType?.FullName
            });

            await _db.SaveChangesAsync();
        }
Пример #6
0
        public async Task HandleAsync(EntityRelationAdded @event)
        {
            _db.EntityRelations.Add(new EntityRelation
            {
                ParentId   = @event.AggregateRootId,
                Name       = @event.Name,
                MetaTypeId = @event.MetaTypeId,
                Minimum    = @event.Minimum,
                Maximum    = @event.Maximum
            });

            await _db.SaveChangesAsync();
        }
        public async Task HandleAsync(AggregateDomainEventPropertyAdded @event)
        {
            _db.DomainEventProperties.Add(new DomainEventProperty
            {
                DomainEventEntityId = @event.AggregateRootId,
                DomainEventName     = @event.DomainEventName,
                Name       = @event.Property.Name,
                MetaTypeId = @event.Property.Type.MetaTypeId,
                SystemType = @event.Property.Type.SystemType?.FullName
            });

            await _db.SaveChangesAsync();
        }
Пример #8
0
        public async Task HandleAsync(EntityRegistered @event)
        {
            var entity = _db.Entities.Add(new Entity
            {
                BoundedContextId = @event.BoundedContextId,
                MetaTypeId       = @event.AggregateRootId,
                Name             = @event.Name
            }).Entity;

            var property = _db.Properties.Add(new Property
            {
                ParentId   = @event.AggregateRootId,
                Name       = @event.Identity.Name,
                MetaTypeId = @event.Identity.Type.MetaTypeId,
                SystemType = @event.Identity.Type.SystemType?.FullName
            }).Entity;

            await _db.SaveChangesAsync();

            entity.Identity = property;

            await _db.SaveChangesAsync();
        }
Пример #9
0
        public async Task <Entity> Create([FromBody] CreateType model)
        {
            var entity = await _metaDbContext.Entities.AddAsync(new Domain.Meta.Entity()
            {
                Id          = Guid.NewGuid(),
                ModuleId    = model.ModuleId,
                Name        = model.Name,
                Description = model.Description
            });

            await _metaDbContext.SaveChangesAsync();

            return(_mapper.Map <Entity>(entity.Entity));
        }
Пример #10
0
 public async Task Delete(Guid id)
 {
     _metaDbContext.Modules.Remove(_metaDbContext.Modules.Find(id));
     await _metaDbContext.SaveChangesAsync();
 }