Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateExtension" /> class using the supplied extension entity names.
        /// </summary>
        public AggregateExtension(DomainModel domainModel, AggregateExtensionDefinition aggregateExtensionDefinition)
        {
            _domainModel = domainModel;

            AggregateRootEntityName = aggregateExtensionDefinition.AggregateRootEntityName;
            ExtensionEntityNames    = aggregateExtensionDefinition.ExtensionEntityNames;
        }
Exemplo n.º 2
0
        public void AddAggregateExtension(AggregateExtensionDefinition aggregateExtensionDefinition)
        {
            // Defensive programming to prevent unexpected behavior caused by "missing" extensions
            if (_finalizedAggregateFullNameByEntityFullName.IsValueCreated)
            {
                throw new InvalidOperationException(
                          $"Aggregate extensions to '{aggregateExtensionDefinition.AggregateRootEntityName}' aggregate are being added after the domain model has been processed for extension entities.");
            }

            var aggregateExtension = new AggregateExtension(this, aggregateExtensionDefinition);

            _aggregateExtensions.Add(aggregateExtension);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Adds an <see cref="AggregateExtensionDefinition" /> to be built into the Domain Model
 /// </summary>
 /// <param name="aggregateExtensionDefinition"></param>
 public void AddAggregateExtension(AggregateExtensionDefinition aggregateExtensionDefinition)
 {
     EnsureDomainModelIsNotNull();
     _domainModel.AddAggregateExtension(aggregateExtensionDefinition);
 }