/// <summary> /// Initializes a new instance of the <see cref="EntityType"/> class. /// </summary> /// <param name="runtimeType">The runtime type.</param> /// <param name="typeAnalyzerService">The type analyzer service.</param> public EntityType(Type runtimeType, ITypeAnalyzerService typeAnalyzerService) : base(new NaturalKey(typeof(EntityType), "RuntimeType", typeof(Type), DefaultTypeAnalyzerService)) { Guard.Against.Null(() => runtimeType); Guard.Against.Null(() => typeAnalyzerService); if (!typeAnalyzerService.IsValidEntity(runtimeType)) { throw new BusinessException( string.Format(CultureInfo.InvariantCulture, "The specified runtime type '{0}' is not an entity.", runtimeType)); } this.RuntimeType = runtimeType; this.entityNaturalKey = typeAnalyzerService.GetNaturalKey(runtimeType); this.Mappings = new MapperCollection(); }