Esempio n. 1
0
        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);
        }
Esempio n. 2
0
		public static DslModeling::LinkedElementCollection<EntityModel> GetEntityModels(ValueObjectModel element)
		{
			return GetRoleCollection<DslModeling::LinkedElementCollection<EntityModel>, EntityModel>(element, ValueObjectModelDomainRoleId);
		}
Esempio n. 3
0
		/// <summary>
		/// Constructor
		/// Creates a EntityModelReferencesValueObjectModels link in the same Partition as the given EntityModel
		/// </summary>
		/// <param name="source">EntityModel to use as the source of the relationship.</param>
		/// <param name="target">ValueObjectModel to use as the target of the relationship.</param>
		public EntityModelReferencesValueObjectModels(EntityModel source, ValueObjectModel target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(EntityModelReferencesValueObjectModels.EntityModelDomainRoleId, source), new DslModeling::RoleAssignment(EntityModelReferencesValueObjectModels.ValueObjectModelDomainRoleId, target)}, null)
		{
		}
Esempio n. 4
0
		public static void SetDominDriveDesignModel(ValueObjectModel element, DominDriveDesignModel newDominDriveDesignModel)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, ValueObjectModelDomainRoleId, newDominDriveDesignModel);
		}
Esempio n. 5
0
		public static DominDriveDesignModel GetDominDriveDesignModel(ValueObjectModel element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, ValueObjectModelDomainRoleId) as DominDriveDesignModel;
		}
Esempio n. 6
0
		/// <summary>
		/// Constructor
		/// Creates a DominDriveDesignModelHasValueObjectModels 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">ValueObjectModel to use as the target of the relationship.</param>
		public DominDriveDesignModelHasValueObjectModels(DominDriveDesignModel source, ValueObjectModel target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(DominDriveDesignModelHasValueObjectModels.DominDriveDesignModelDomainRoleId, source), new DslModeling::RoleAssignment(DominDriveDesignModelHasValueObjectModels.ValueObjectModelDomainRoleId, target)}, null)
		{
		}