Asphostportal Code First Migration from ASP.NET MVC 5

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Asphostportal Code First Migration from ASP.NET MVC 5

    I have created a ASP.NET MVC5 project and I am hosting the website in asphostportal. I am facing a problem when doing code first migration. When I add Enable-Migrations, Add-Migration Initial create and Update-Database from Nuget, Only ASP.Net Identity table and two database context table gets created in asphostportal Database and a new copy of all the table will be created in my local SQLEXPRESS server. I have tried to recreate the migration Several times but changes. Eg: I have database table A,B,C,D,E,F and ASP.NET Identity table 1,2,3,4. In asphostportal after running Migration 1,2,3,4,E,F table get created and In local .SQLEXPRESS A,B,,C,D,E,F gets created. At present no matter how many times I delete the migration folder, drop both tables from asphostportal and Local SQLExpress server the result is the same.
    When I run Enable-Migrations I get the Error


    Code:
    More than one context type was found in the assembly 'Hotel'. To enable migrations for 'Hotel.Models.DatabaseContext', use Enable-Migrations -ContextTypeName Hotel.Models.DatabaseContext. To enable migrations for 'Hotel.Models.ApplicationDbContext', use Enable-Migrations -ContextTypeName Hotel.Models.ApplicationDbContext.
    So I select



    Code:
    Enable-Migrations -ContextTypeName Hotel.Models.DatabaseContext
    and tried with ApplicationdbContext, but will get an error when created the data for the table (A,B,C,D,E,F).
    How can I move all my table to asphostportal database
    Zuletzt geändert von jatloui; 30.06.2016, 09:02. Grund: asp.net, sql, asp.net mvc

  • #2
    Asphostportal Code First Migration from ASP.NET MVC 5

    I have created a ASP.NET MVC5 project and I am hosting the website in asphostportal. I am facing a problem when doing code first migration. When I add Enable-Migrations, Add-Migration Initial create and Update-Database from Nuget, Only ASP.Net Identity table and two database context table gets created in asphostportal Database and a new copy of all the table will be created in my local SQLEXPRESS server. I have tried to recreate the migration Several times but changes. Eg: I have database table A,B,C,D,E,F and ASP.NET Identity table 1,2,3,4. In asphostportal after running Migration 1,2,3,4,E,F table get created and In local .SQLEXPRESS A,B,,C,D,E,F gets created. At present no matter how many times I delete the migration folder, drop both tables from asphostportal and Local SQLExpress server the result is the same.
    When I run Enable-Migrations I get the Error


    Code:
    More than one context type was found in the assembly 'Hotel'. To enable migrations for 'Hotel.Models.DatabaseContext', use Enable-Migrations -ContextTypeName Hotel.Models.DatabaseContext. To enable migrations for 'Hotel.Models.ApplicationDbContext', use Enable-Migrations -ContextTypeName Hotel.Models.ApplicationDbContext.
    So I select



    Code:
    Enable-Migrations -ContextTypeName Hotel.Models.DatabaseContext
    and tried with ApplicationdbContext, but will get an error when created the data for the table (A,B,C,D,E,F).
    How can I move all my table to asphostportal database[/QUOTE]

    Kommentar

    Lädt...
    X