Value can't be null, parameter name: seqOwner

asp.net-identity asp.net-mvc c# entity-framework-6 oracle

Question

I'm attempting to utilise identity as an authentication service for a project. I'm attempting to map the object to an existing database to do this. I believe this section is finished and functioning at this time, however when I attempt to log in, an issue occurs, and I'm not sure how to resolve it.

It states that seqOwner cannot be null; thus, I am baffled as to why Oracle is attempting to establish a series.

This is my IdentityModel.cs file.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.HasDefaultSchema("SCHEMA1");
            modelBuilder.Entity<ApplicationUser>().ToTable("SCHEMA1.PERSONNELS", "SCHEMA1$USER");
            modelBuilder.Entity<ApplicationUser>().Property(p => p.UserName).HasColumnName("PE_USERNAME");
            modelBuilder.Entity<ApplicationUser>().Property(p => p.PasswordHash).HasColumnName("PE_MDPEXTRA").IsOptional();
            modelBuilder.Entity<ApplicationUser>().Property(p => p.Email).HasColumnName("PE_MAIL");
            modelBuilder.Entity<ApplicationUser>().Property(p => p.Id).HasColumnName("PE_ID");
            modelBuilder.Entity<ApplicationUser>().Ignore(c => c.AccessFailedCount)
                                                   .Ignore(c => c.LockoutEnabled)
                                                   .Ignore(c => c.LockoutEndDateUtc)
                                                   .Ignore(c => c.EmailConfirmed)
                                                   .Ignore(c => c.SecurityStamp)
                                                   .Ignore(c => c.TwoFactorEnabled)
                                                   .Ignore(c => c.PhoneNumberConfirmed)
                                                   .Ignore(c => c.PhoneNumber);
        }

This connection string is flawless and allows me to view the tables and sequences.

<add name="IdentityContext" connectionString="DATA SOURCE=gesmardev.world;PASSWORD=gesmar;PERSIST SECURITY INFO=True;USER ID=&quot;GESMAR$USER&quot;" providerName="Oracle.ManagedDataAccess.Client" />

Here is the stack of mistakes:

Oracle.ManagedDataAccess.EntityFramework.EntityUtils.CheckArgumentNull(T value, String parameterName) +44
   Oracle.ManagedDataAccess.EntityFramework.OracleMigrationSqlGenerator.GenerateSequenceCreate(String seqOwner, String seqName) +47
   Oracle.ManagedDataAccess.EntityFramework.OracleMigrationSqlGenerator.Generate(CreateTableOperation createTableOperation) +1278
   CallSite.Target(Closure , CallSite , OracleMigrationSqlGenerator , Object ) +193
   Oracle.ManagedDataAccess.EntityFramework.OracleMigrationSqlGenerator.<GenerateStatements>b__2(Object op) +183
   Oracle.ManagedDataAccess.EntityFramework.EntityUtils.Each(IEnumerable`1 ts, Action`1 action) +130
   Oracle.ManagedDataAccess.EntityFramework.OracleMigrationSqlGenerator.GenerateStatements(IEnumerable`1 migrationOperations) +81
   Oracle.ManagedDataAccess.EntityFramework.OracleMigrationSqlGenerator.Generate(IEnumerable`1 migrationOperations, String providerManifestToken) +94
   System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList`1 operations, String migrationId) +30
   System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, VersionedModel targetModel, IEnumerable`1 operations, IEnumerable`1 systemOperations, Boolean downgrading, Boolean auto) +699
   System.Data.Entity.Migrations.DbMigrator.AutoMigrate(String migrationId, VersionedModel sourceModel, VersionedModel targetModel, Boolean downgrading) +562
   System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId) +404
   System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration) +447
   System.Data.Entity.Migrations.<>c__DisplayClassc.<Update>b__b() +13
   System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +422
   System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +78
   System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func`3 createMigrator, ObjectContext objectContext) +89
   System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext, DatabaseExistenceState existenceState) +116
   System.Data.Entity.Database.Create(DatabaseExistenceState existenceState) +218
   System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +151
   System.Data.Entity.Internal.<>c__DisplayClassf`1.<CreateInitializationAction>b__e() +76
   System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +60
   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +357
   System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +7
   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +110
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +198
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +38
   System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable`1 source, Expression`1 predicate, CancellationToken cancellationToken) +138
   System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable`1 source, Expression`1 predicate) +145
   Microsoft.AspNet.Identity.EntityFramework.<GetUserAggregateAsync>d__6c.MoveNext() +498
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   Microsoft.AspNet.Identity.CultureAwaiter`1.GetResult() +59
   Microsoft.AspNet.Identity.Owin.<PasswordSignInAsync>d__29.MoveNext() +354
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
   WebApplication1.Controllers.<Login>d__11.MoveNext() in C:\Users\TAMBARIN\Documents\Visual Studio 2015\Projects\WebApplication1\WebApplication1\Controllers\AccountController.cs:79
1
0
4/28/2018 1:41:13 PM

Accepted Answer

So essentially, I'm simply instructing Entity Framework not to build a series using this to prevent the problem:

modelBuilder.Entity<ApplicationUser>().Property(p => p.Id).HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.None);

In order to avoid trying to automatically increase the main key and avoid having to establish a sequence,

0
4/26/2018 1:01:45 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow