I am trying to use the MVC (version 5) identity membership provider with an Oracle database (11 g). I have already created a database and installed all the necessary tables (ORA_ASPNET_APPLICATIONS, ORA_ASPNET_USERS, etc). I have also downloaded Oracle Developer Tools for Visual Studio, and have installed and referenced the Oracle.ManagedDataAccess and Oracle.ManagedDataAccess.EntityFramework assemblies. When I try to add a new user, the application breaks at this line:
var result = await UserManager.CreateAsync(user, model.Password);
And I get the following error:
ORA-01918: user 'dbo' does not exist
I looked at the stack track and -- based on the contents -- it looks like the application is trying to create a new database (see below):
System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
I'm not sure why, though, since the database already exists. I have only one connection string in my web.config, and it points to the Oracle database I created.
Has anyone been able to get the MVC membership provider to work with Oracle? If so, can anyone provide me with any assistance? I already looked at this link -- Oracle.ManagedDataAccess.EntityFramework - ORA-01918: user 'dbo' does not exist -- but I'm not using code-first, so I don't think any of the suggestions apply in my situation.
My connection string is below:
<add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=MyOracleAccountUserName;Password=MyOracleAccountPassword;Data Source=MyOracleDataSource" />
I don't think it's the connection string, though. I also tried overriding the OnModelCreating method as follows:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.HasDefaultSchema("MySchemaName");
modelBuilder.Entity<ApplicationUser>().ToTable("ORA_ASPNET_USERS");
modelBuilder.Entity<IdentityRole>().ToTable("ORA_ASPNET_ROLES");
modelBuilder.Entity<IdentityUserRole>().ToTable("ORA_ASPNET_USERSINROLES");
}
But, when I do that, I get a different error: ORA-00904: "Extent1"."UserName": invalid identifier.