With version 4.4,
EntityFrameworkCore.DbMigrationsproject has been removed and DbContexts are unified. You can check this community article to understand the circumstances under that. If you were migrated your application from 4.3 to 4.4 please apply the steps in the article to unify your db context.
Can you examine your db context class inherit from ISaasDbContext or not?
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))] //ensure this line is exists
[ConnectionStringName("Default")]
public class MyDbContext :
AbpDbContext<MyDbContext>,
IIdentityProDbContext,
ISaasDbContext //ensure this line is exists
{
//...
}
You're welcome. I am closing the question since your problem is resolved.
Can you check your YourEntityFrameworkCoreModule depend on AbpSettingManagementEntityFrameworkCoreModule?
//other dependent modules
[DependsOn(typeof(AbpSettingManagementEntityFrameworkCoreModule))] //check this line exists or not
public class YourEntityFrameworkCoreModule : AbpModule
{
//...
}
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))]
[ConnectionStringName("Default")]
public class YourProjectDbContext :
AbpDbContext<YourProjectDbContext>,
IIdentityProDbContext,
ISaasDbContext
{
//...
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigureSettingManagement(); //check this line exists or not
//other configurations (e.g. builder.ConfigureAuditLogging())
}
}
Hi @radhikashrotre, what is your ABP Framework version?
Did you define claims for the user that try to login passwordless, like here? These claims are required for user and role specific permissions.
Hi @viswajwalith, there is a community article about passwordless authentication, you can read from here. Can you check it and ensure there are not any steps that you missed?
Hi @david.hurtado, please wrap your create and update methods with try-catch blocks and handle exception by yourself (by using HandleErrorAsync method). => https://support.abp.io/QA/Questions/1523/Blazor-Server-ABP-Exception-Dialog-not-shown#answer-7939465b-3349-3100-2cc1-39fd4fd8c78a
And also, you can check the validations (are granted or not) inside of your create and update methods.
private Validations NewSalesmanValidations { get; set; } //validation that used in your create modal
//...
private async Task CreateNewSalesmanAsync()
{
try
{
//if all validation rules are not validated, simply don't do anything
if (NewSalesmanValidations?.ValidateAll() == false)
{
return;
}
await SalesmanAppService.CreateAsync(NewSalesman);
await GetSalesmanAsync();
CreateSalesmanModal.Hide();
}
catch (Exception ex)
{
await HandleErrorAsync(ex); //handles the exception and prevent app crash
}
}
Hi @rafal.woznicki, there is no planned relase date for v4.4.3 for now. I will inform you when it's released.
using Microsoft.AspNetCore.Hosting; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Sqlite; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.LanguageManagement.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Uow; using Volo.Saas.EntityFrameworkCore; namespace *************.EntityFrameworkCore { [DependsOn( typeof(*************TestBaseModule), typeof(*************EntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) )] public class *************EntityFrameworkCoreTestModule : AbpModule { private SqliteConnection _sqliteConnection; public override void ConfigureServices(ServiceConfigurationContext context) { ConfigureInMemorySqlite(context.Services); context.Services.AddSingleton<IWebHostEnvironment>(new WebHostEnvironmentMockEntity()); } private void ConfigureInMemorySqlite(IServiceCollection services) { _sqliteConnection = CreateDatabaseAndGetConnection(); Configure<AbpUnitOfWorkDefaultOptions>(options => { options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; }); services.Configure<AbpDbContextOptions>(options => { options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); }); }); } public override void OnApplicationShutdown(ApplicationShutdownContext context) { _sqliteConnection.Dispose(); } private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); new *************DbContext( new DbContextOptionsBuilder<*************DbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables(); new IdentityDbContext( new DbContextOptionsBuilder<IdentityDbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables(); new PermissionManagementDbContext( new DbContextOptionsBuilder<PermissionManagementDbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables(); new SettingManagementDbContext( new DbContextOptionsBuilder<SettingManagementDbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables(); new LanguageManagementDbContext( new DbContextOptionsBuilder<LanguageManagementDbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables(); new SaasDbContext( new DbContextOptionsBuilder<SaasDbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables(); return connection; } } }
You don't need to specify dependent module contexts in here. You only need to define your own db context (*************DbContext) here. So please update your CreateDatabaseAndGetConnection method as below.
private static SqliteConnection CreateDatabaseAndGetConnection()
{
var connection = new SqliteConnection("Data Source=:memory:");
connection.Open();
var options = new DbContextOptionsBuilder<*************DbContext>()
.UseSqlite(connection)
.Options;
using (var context = new *************DbContext(options))
{
context.GetService<IRelationalDatabaseCreator>().CreateTables();
}
return connection;
}
Can you add the DomainTenantResolveContributor to TenantResolvers and try again?
DomainTenantResolveContributor: Tries to resolve tenancy name from an url, generally from a domain or subdomain.
Configure<AbpTenantResolveOptions>(options =>
{
options.AddDomainTenantResolver("{0}.somedomain.com");
options.TenantResolvers.Add(new DomainTenantResolveContributor()); //add DomainTenantResolveContributor
//...
});