/// <summary> /// Creates a new instance of the <see cref="OracleIdentityDbContext"/> class with /// the specified connections string and <see cref="IRolesTableCommands"/>. /// </summary> /// <param name="connectionString">The connection string to use when connecting to the Oracle database.</param> /// <param name="contextNomenclature"> /// Instance of <see cref="IContextNomenclature"/> containing the naming settings for each of the database objects. /// </param> /// <param name="enableCaseInsensitiveSearching"> /// A <see cref="bool"/> value indicating whether case insensitive searches should be used when querying the database. /// <para> /// When set to <c>true</c>, the following Oracle session parameters are set: /// <list type="bullet"> /// <item> /// <term>NLS_SORT</term> /// <description>"BINARY_CI"</description> /// </item> /// <item> /// <term>NLS_SORT</term> /// <description>"LINGUISTIC"</description> /// </item> /// </list> /// </para> /// </param> /// <exception cref="ArgumentNullException"> /// Thrown if the <paramref name="connectionString"/> parameter is /// <c>null</c>, an empty string, or only consists of white space characters. /// </exception> /// <seealso cref="http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams145.htm#REFRN10127"> /// Oracle Database Reference: NLS_SORT /// </seealso> /// <seealso cref="http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams135.htm#REFRN10117"> /// Oracle Database Reference: NLS_COMP /// </seealso> public OracleIdentityDbContext(string connectionString, IContextNomenclature contextNomenclature = null, bool enableCaseInsensitiveSearching = true) { if (String.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentNullException(nameof(connectionString)); } this.connectionString = connectionString; ContextNomenclature = contextNomenclature ?? new OracleContextNomenclature(); this.enableCaseInsensitiveSearching = enableCaseInsensitiveSearching; RolesTableCommands = new RolesTableSqlCommands(ContextNomenclature.RolesTableNomenclature); UserClaimsTableCommands = new UserClaimsTableSqlCommands(ContextNomenclature.UserClaimsTableNomenclature); UserLoginsTableCommands = new UserLoginsTableSqlCommands(ContextNomenclature.UserLoginsTableNomenclature); UserRolesTableCommands = new UserRolesTableSqlCommands(ContextNomenclature.UserRolesTableNomenclature, ContextNomenclature.RolesTableNomenclature); UsersTableCommands = new UsersTableSqlCommands(ContextNomenclature.UsersTableNomenclature); }
/// <summary>Gets a string containing the DDL necessary for creating the ASP.NET Identity database objects.</summary> /// <returns>A string containing the DDL necessary for creating the ASP.NET Identity database objects.</returns> public override string GenerateObjectCreationSql() { var rolesNomenclature = RolesTableCommands.TableNomenclature; var usersNomenclature = UsersTableCommands.TableNomenclature; var userClaimsNomenclature = UserClaimsTableCommands.TableNomenclature; var userLoginsNomenclature = UserLoginsTableCommands.TableNomenclature; var userRolesNomenclature = UserRolesTableCommands.UserRolesTableNomenclature; var ddlScript = new System.Text.StringBuilder() .AppendLine(RolesTableSqlCommands.GenerateCreationSql(rolesNomenclature)) .AppendLine(UsersTableSqlCommands.GenerateCreationSql(usersNomenclature)) .AppendLine(UserClaimsTableSqlCommands.GenerateCreationSql(userClaimsNomenclature)) .AppendLine(UserLoginsTableSqlCommands.GenerateCreationSql(userLoginsNomenclature, usersNomenclature)) .AppendLine(UserRolesTableSqlCommands.GenerateCreationSql(userRolesNomenclature, rolesNomenclature, usersNomenclature)); return(ddlScript.ToString()); }