Open Closed

No User found after running "Update-Database" #5408


0
kumaran created

After fresh install and running Update-Database, i do not see any user in my local db. I do see all the tables created but no data including user table.

Here is my connection string. Server=(localdb)\MSSQLLocalDB;Initial Catalog=xxDb;Integrated Security=True;

I have tried this with demo application and it worked. This is not working only after i downloaded the premium code. Need help.


9 Answer(s)
  • 0
    maliming created

    The application will automatically initialize the data when it starts. So start your website.

  • 0
    kumaran created

    Additional information on my error: I have disabled multi-tenant and also i see that the seedHelper.cs code is not getting called when i run the host. Also i see that the seed folder is under the Migration folder vs seed folder found under EntityFrameworkCore folder for demo sites.

  • 0
    kumaran created

    maliming: The application will automatically initialize the data when it starts. So start your website.

    Hi I ran the site but still not working and there are no data in the table. I still see the seed code is not getting called.

    I have the host running and when i run the angular site, i get internal error because there is no data.

  • 0
    ismcagdas created

    Hi,

    Do you have this line https://github.com/aspnetzero/aspnet-ze ... per.cs#L37 in your DatabaseCheckHelper.cs class ? There was a similar bug but fixed.

  • 0
    kumaran created

    OK, this is what i found. I went back and enabled multi-tenant and then ran the host and the site, then it created the user data. But there is a new problem. I have 2 admin account now in my user table. One with shouldChangePasswordOnNextLogin = true and the other one is false. I dont know what's going on.

  • 0
    kumaran created

    additional difference in 2 admin rows. One had tenant id and one does not. Not this make sense that one of them is for the tenant. Now my only question is why do i have to enable multi-tenant to get the site working even if i dont want multi-tenant.

  • 0
    alper created

    I think it's normal. One is for the tenant, one is for the host. [attachment=0:t3wyk7ru]2admins.jpg[/attachment:t3wyk7ru] 2admins.jpg

  • 0
    ryancyq created

    Tested with aspnetzero 5.5.2 and I am able to reproduce the issue.

    1. Download new template
    2. dotnet ef update database
    3. Set Const.MultiTenancyEnabled = false
    4. Run Web.Host project

    SeedHostDb() will be skipped at https://github.com/aspnetzero/aspnet-ze ... ule.cs#L61

    Because DatabaseCheckHelper.Exist() return false

    As mentioned by @ismcagdas, the issue may be related to https://github.com/aspnetzero/aspnet-ze ... per.cs#L37

    Also, I found that when DatabaseCheckHelper.Exist() open database connection, null multiTenancySide is passed into https://github.com/aspnetboilerplate/as ... ons.cs#L24

    Subsequently, it is used in https://github.com/aspnetboilerplate/as ... ork.cs#L99 and https://github.com/aspnetboilerplate/as ... rk.cs#L107

    Ultimately, when getting database connection at https://github.com/aspnetboilerplate/as ... ver.cs#L40

    Since multiTenancySide is null and it will attempt to retrieve tenant database connection. Capture.PNG

  • 0
    alper created

    thanks @ryancyq for the complete report.