/// <summary> /// Initializes a new instance of the <see cref="ConfiguredContext" /> class. /// </summary> /// <param name="applicationConfiguration"> /// Configuration information for the application. /// </param> /// <param name="databaseType"> /// The database type of the backing database. The default value is <see cref="ContextDatabaseType.SQLServer" />. /// </param> /// <param name="databaseName"> /// The name of the backing database, which matches the associated connection string key in /// <paramref name="applicationConfiguration" />. The default value is equal to the context's type name with "Context" /// trimmed from the end, if found. /// </param> /// <param name="trackingBehavior"> /// The query result tracking behavior for the context. The default value is <see cref="QueryTrackingBehavior.TrackAll" />. /// </param> /// <exception cref="ArgumentEmptyException"> /// <paramref name="databaseName" /> is empty. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="applicationConfiguration" /> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" />. /// </exception> public ConfiguredContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, String databaseName, QueryTrackingBehavior trackingBehavior) : base() { ApplicationConfiguration = applicationConfiguration.RejectIf().IsNull(nameof(applicationConfiguration)).TargetArgument; DatabaseNameReference = (databaseName ?? UseConventionalDatabaseNameIndicator).RejectIf().IsNullOrEmpty(nameof(databaseName)); DatabaseType = databaseType.RejectIf().IsEqualToValue(ContextDatabaseType.Unspecified, nameof(databaseType)); TrackingBehavior = trackingBehavior; }
/// <summary> /// Initializes a new instance of the <see cref="ConfiguredContext" /> class. /// </summary> /// <param name="applicationConfiguration"> /// Configuration information for the application. /// </param> /// <param name="databaseType"> /// The database type of the backing database. The default value is <see cref="ContextDatabaseType.SQLServer" />. /// </param> /// <param name="databaseName"> /// The name of the backing database, which matches the associated connection string key in /// <paramref name="applicationConfiguration" />. The default value is equal to the context's type name with "Context" /// trimmed from the end, if found. /// </param> /// <exception cref="ArgumentEmptyException"> /// <paramref name="databaseName" /> is empty. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="applicationConfiguration" /> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" />. /// </exception> public ConfiguredContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, String databaseName) : this(applicationConfiguration, databaseType, databaseName ?? UseConventionalDatabaseNameIndicator, DefaultTrackingBehavior) { return; }
/// <summary> /// Initializes a new instance of the <see cref="ConfiguredContext" /> class. /// </summary> /// <param name="applicationConfiguration"> /// Configuration information for the application. /// </param> /// <param name="databaseType"> /// The database type of the backing database. The default value is <see cref="ContextDatabaseType.SQLServer" />. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="applicationConfiguration" /> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" />. /// </exception> public ConfiguredContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType) : this(applicationConfiguration, databaseType, UseConventionalDatabaseNameIndicator) { return; }
/// <summary> /// Initializes a new instance of the <see cref="PrototypeContext" /> class. /// </summary> /// <param name="applicationConfiguration"> /// Configuration information for the application. /// </param> /// <param name="databaseType"> /// The database type of the backing database. The default value is <see cref="ContextDatabaseType.SQLServer" />. /// </param> /// <param name="databaseName"> /// The name of the backing database, which matches the associated connection string key in /// <paramref name="applicationConfiguration" />. The default value is equal to the context's type name with "Context" /// trimmed from the end, if found. /// </param> /// <exception cref="ArgumentEmptyException"> /// <paramref name="databaseName" /> is empty. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="applicationConfiguration" /> is <see langword="null" /> -or- <paramref name="databaseName" /> is /// <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" />. /// </exception> public PrototypeContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, String databaseName) : base(applicationConfiguration, databaseType, databaseName) { return; }
/// <summary> /// Initializes a new instance of the <see cref="PrototypeContext" /> class. /// </summary> /// <param name="applicationConfiguration"> /// Configuration information for the application. /// </param> /// <param name="databaseType"> /// The database type of the backing database. The default value is <see cref="ContextDatabaseType.SQLServer" />. /// </param> /// <param name="databaseName"> /// The name of the backing database, which matches the associated connection string key in /// <paramref name="applicationConfiguration" />. The default value is equal to the context's type name with "Context" /// trimmed from the end, if found. /// </param> /// <param name="trackingBehavior"> /// The query result tracking behavior for the context. The default value is <see cref="QueryTrackingBehavior.TrackAll" />. /// </param> /// <exception cref="ArgumentEmptyException"> /// <paramref name="databaseName" /> is empty. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="applicationConfiguration" /> is <see langword="null" /> -or- <paramref name="databaseName" /> is /// <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="databaseType" /> is equal to <see cref="ContextDatabaseType.Unspecified" />. /// </exception> public PrototypeContext(IConfiguration applicationConfiguration, ContextDatabaseType databaseType, String databaseName, QueryTrackingBehavior trackingBehavior) : base(applicationConfiguration, databaseType, databaseName, trackingBehavior) { return; }