public Glossary CreateGlossary(string domainAssembly) { var types = _fileLoader.GetTypesFromAssembly(domainAssembly); var glossary = new Glossary(); foreach (var t in types) { var attributes = t.GetCustomAttributes(true); if (attributes.Any(a => a is AggregateRoot)) { var aggregateRootTerm = attributes.OfType <AggregateRoot>().First(); var module = glossary.CreateOrGetModuleFrom(aggregateRootTerm); var aggregateRootModel = new AggregateRootModel { Name = aggregateRootTerm.Name, Definition = aggregateRootTerm.Definition }; aggregateRootModel.Entities.AddRange(GetEntitiesFromProperties(t)); aggregateRootModel.ValueObjects.AddRange(GetValueObjectsFromProperties(t)); aggregateRootModel.CommandMethods.AddRange(GetCommandMethods(t)); module.Aggregates.Add(aggregateRootModel); } else if (attributes.Any(a => a is Entity)) { var entityTerm = attributes.OfType <Entity>().First(); var module = glossary.CreateOrGetModuleFrom(entityTerm); var entityModel = new EntityModel { Name = entityTerm.Name, Definition = entityTerm.Definition }; entityModel.ValueObjects.AddRange(GetValueObjectsFromProperties(t)); entityModel.CommandMethods.AddRange(GetCommandMethods(t)); module.Entities.Add(entityModel); } else if (attributes.Any(a => a is ValueObject)) { var valueObjectTerm = attributes.OfType <ValueObject>().First(); var module = glossary.CreateOrGetModuleFrom(valueObjectTerm); var valueObjectModel = new ValueObjectModel { Name = valueObjectTerm.Name, Definition = valueObjectTerm.Definition }; module.ValueObjects.Add(valueObjectModel); } else if (attributes.Any(a => a is DomainService)) { var domainServiceTerm = attributes.OfType <DomainService>().First(); var module = glossary.CreateOrGetModuleFrom(domainServiceTerm); var domainServiceModel = new DomainServiceModel { Name = domainServiceTerm.Name, Definition = domainServiceTerm.Definition }; module.DomainServices.Add(domainServiceModel); } else if (attributes.Any(a => a is DomainEvent)) { var domainEventTerm = attributes.OfType <DomainEvent>().First(); var module = glossary.CreateOrGetModuleFrom(domainEventTerm); var domainEventModel = new DomainEventModel { Name = domainEventTerm.Name, Definition = domainEventTerm.Definition }; module.DomainEvents.Add(domainEventModel); } } return(glossary); }
public static DominDriveDesignModel GetDominDriveDesignModel(DomainEventModel element) { return DslModeling::DomainRoleInfo.GetLinkedElement(element, DomainEventModelDomainRoleId) as DominDriveDesignModel; }
public static void SetDominDriveDesignModel(DomainEventModel element, DominDriveDesignModel newDominDriveDesignModel) { DslModeling::DomainRoleInfo.SetLinkedElement(element, DomainEventModelDomainRoleId, newDominDriveDesignModel); }
/// <summary> /// Constructor /// Creates a DominDriveDesignModelHasDomainEventModels link in the same Partition as the given DominDriveDesignModel /// </summary> /// <param name="source">DominDriveDesignModel to use as the source of the relationship.</param> /// <param name="target">DomainEventModel to use as the target of the relationship.</param> public DominDriveDesignModelHasDomainEventModels(DominDriveDesignModel source, DomainEventModel target) : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(DominDriveDesignModelHasDomainEventModels.DominDriveDesignModelDomainRoleId, source), new DslModeling::RoleAssignment(DominDriveDesignModelHasDomainEventModels.DomainEventModelDomainRoleId, target)}, null) { }