IMPORTANT!
This forum is now archived. Click here for the New Support Forum
Migration problem after conversion to QuickApp.pro 3.0
Quote from Ingo on October 11, 2019, 12:49 pmHi,
By default, I had to move the migration from QuickApp.pro to the DAL. Since I have a console application which also uses the DAL. I changed the class DesignTimeDbContextFactory as follows.
builder.UseSqlServer(configuration["ConnectionStrings:DefaultConnection"], b => b.MigrationsAssembly("DAL"));I changed the class Startup as follows.
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"], b => b.MigrationsAssembly("DAL")));DAL.csproj I add
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>If I am in the package manager for example:
Select the DAL and enter add-migration Vers14, the migration was created.
In version 3.0 I did the same:
DAL.csproj I add
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0"> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets> </PackageReference> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference>If I am in the package manager for example:
Select the DAL and enter add-migration Vers14, the migration was not created.
Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
The link is not helpful because all calls are available. If it's helpful to you, I'm happy to send you my code.
What can I do???
regards Ingo
Hi,
By default, I had to move the migration from QuickApp.pro to the DAL. Since I have a console application which also uses the DAL. I changed the class DesignTimeDbContextFactory as follows.
builder.UseSqlServer(configuration["ConnectionStrings:DefaultConnection"], b => b.MigrationsAssembly("DAL"));
I changed the class Startup as follows.
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"], b => b.MigrationsAssembly("DAL")));
DAL.csproj I add
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
If I am in the package manager for example:
Select the DAL and enter add-migration Vers14, the migration was created.
In version 3.0 I did the same:
DAL.csproj I add
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0"> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets> </PackageReference> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference>
If I am in the package manager for example:
Select the DAL and enter add-migration Vers14, the migration was not created.
Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
The link is not helpful because all calls are available. If it's helpful to you, I'm happy to send you my code.
What can I do???
regards Ingo
IMPORTANT!
This forum is now archived. Click here for the New Support Forum