/// <summary> /// Initializes a new instance of the <see cref="AggregateRootType"/> class. /// </summary> /// <param name="runtimeType">The runtime type.</param> /// <param name="typeAnalyzerService">The type analyzer service.</param> /// <param name="baseEntity">The base entity.</param> public AggregateRootType(Type runtimeType, ITypeAnalyzerService typeAnalyzerService, EntityType baseEntity) : base(runtimeType, typeAnalyzerService, baseEntity) { Guard.Against.Null(() => runtimeType); Guard.Against.Null(() => typeAnalyzerService); if (!typeAnalyzerService.IsValidAggregateRoot(runtimeType)) { throw new BusinessException( string.Format(CultureInfo.InvariantCulture, "The specified runtime type '{0}' is not an aggregate root.", runtimeType)); } // NOTE (Cameron): Defaults. this.UninitializedFactory = typeAnalyzerService.GetUninitializedFactory(runtimeType); this.EventDispatcher = new DefaultEventDispatcher(runtimeType); }