@piapps
You can try modifying the DbContextFactory as follows:
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")
public class AbpZeroTemplateDbContextFactory : IDesignTimeDbContextFactory<AbpZeroTemplateDbContext>
{
public AbpZeroTemplateDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<AbpZeroTemplateDbContext>();
var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), addUserSecrets: true);
AbpZeroTemplateDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AbpZeroTemplateConsts.ConnectionStringName));
return new AbpZeroTemplateDbContext(builder.Options);
}
}
PM> $Env:ASPNETCORE_ENVIRONMENT = "Staging"
PM> $Env:ASPNETCORE_ENVIRONMENT
Staging
PM> Update-Database
Applying migration '20170406083347_Initial_Migration'.
Applying migration '20170623075109_AspNetZero_V4_1_Changes'.
Applying migration '20170704084731_Added_GoogleAuthenticatorKey_Column'.
Applying migration '20170714081027_Added_Relation_Between_Edition_And_SubscriptionPayment'.
Applying migration '20170724142223_Upgraded_To_Abp_V2_2'.
Applying migration '20170913133916_Added_SharedMessageId_To_ChatMessage'.
Applying migration '20170914070123_Added_ReceiverReadState_To_ChatMessage'.
Applying migration '20170914084815_Invoice_Changes'.
Applying migration '20170914121022_TypeChange_SharedMessageId_String_Guid'.
Applying migration '20180118065703_Added_Entity_History'.
Applying migration '20180320065710_Upgraded_To_Abp_V3_5'.
Applying migration '20180718081610_Abp_v3_7_Changes'.
Applying migration '20180726063233_Upgraded_ABP_v3.8.0'.
Applying migration '20180731052649_Upgrade_ABP_v3.8.1'.
Applying migration '20180807062930_Upgrade_ABP_v3.8.2'.
Applying migration '20181012141151_Upgraded_To_Abp_v3_9_0'.
Applying migration '20190103081952_Recurring_Payment_Changes'.
Applying migration '20190208083524_Upgraded_To_Abp_v4_2_0'.
Applying migration '20190304131651_Added_User_OrganizationUnits'.
Done.
PM>
You can try this solution: https://entityframework.net/knowledge-base/48913968/net-core-2---entity-framework--update-database-of-different-environment
Related discussion: https://github.com/aspnet/EntityFrameworkCore/issues/7353
@tomop Zero uses this tool, please refer to its documentation. https://github.com/madskristensen/WebCompiler
@tomop It exists in the Web.Mvc.csproj file
try run npm run create-bundles
in Web.Public folder.
If you don't use zero. Just a simple project using EF core and oracle. Can the migration be successful?
Is it a brand new database?
You can also change the log component, such as NLOG(https://github.com/NLog/NLog/wiki/Mail-target), which supports the net core very well.
Can you talk about the usage scenario of the shared session?