IdentityDbContext RRS feed

  • Question

  • User-309523270 posted


    I had to upgrade Oracle version from 12c to 19c.  I am using ASP.Net Core 2.2. 

    I was able to retrieve my user-defined tables.  However, I am unable to retrieve the Identity tables. 

    In this code, user returns null:

    var user = await _userManager.FindByNameAsync(model.Username.ToUpper());

    My initial database used to create(using scaffolding) is not the same database name/server used in the new upgrade server.

        public partial class ToolsDbContext : IdentityDbContext<AppUser>
            public ToolsDbContext()

            public ToolsDbContext(DbContextOptions<ToolsDbContext> options)
                : base(options)

            protected override void OnModelCreating(ModelBuilder modelBuilder)
                modelBuilder.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
                    .HasAnnotation("Relational:DefaultSchema", "TOOLS_TS");


    I suppose I can add the Identity tables in ToolsDBContext but that seems to be the wrong approach.  I thought the "base.OnModelCreating(modelBuilder);  " will resolve it, but unfortunately, did not.

    Please help!



    Friday, September 4, 2020 5:07 PM

All replies

  • User1686398519 posted

    Hi tinac99,

    1. You can check if you can connect to the database.
    2. In addition, you need to check whether you have Migrations, and map the database and model.
    3. You can click here to learn about Scaffold Identity in ASP.NET Core projects.

    Best Regards,


    Monday, September 7, 2020 8:48 AM
  • User753101303 posted


    A bit unclear. I would double check if I'm reading from the expected db and if I see this name in the corresponding tables. Then it seems you are talking about not having identity tables but then I would expect another kind of error.

    For now I suspect you really don't have this user in an existing table.

    Not directly related but ToUpper should be useless. Edit: it uses https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.ilookupnormalizer?view=aspnetcore-3.1 to allow emails and names normalization.

    Anyway I would start by looking at which db and which data I have to make sure ASP.NET Identity is really supposed to find the user I'm trying to find.

    Monday, September 7, 2020 9:39 AM