Hi team, i am moving from the old aspnet boilerplate to the new one. In the old abp, i had an endpoint that you authenticate with and it gives back a token. The authenticate endpoint in this system doesnt return a JWT token ?
Hi team, First of all thanks alot of the amazing work with the ABP Commercial.
I am currently having an issue that seems obvious but i might be doing something wrong, would really appreciate your help as i am stuck.
So when i am trying to run my initial Db migration, i am getting this error :
System.InvalidOperationException: 'The property 'AppUser.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.'
I followed the guide to extend AppUser Entity :
My AppUser Entity :
namespace Dukkantek.Users {
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser
{
#region Base properties
/* These properties are shared with the IdentityUser entity of the Identity module.
* Do not change these properties through this class. Instead, use Identity module
* services (like IdentityUserManager) to change them.
* So, this properties are designed as read only!
*/
public virtual Guid? TenantId { get; private set; }
public virtual string UserName { get; private set; }
public virtual string Name { get; private set; }
public virtual string Surname { get; private set; }
public virtual string Email { get; private set; }
public virtual bool EmailConfirmed { get; private set; }
public virtual string PhoneNumber { get; private set; }
public virtual bool PhoneNumberConfirmed { get; private set; }
#endregion
/* Add your own properties here. Example:
*
* public virtual string MyProperty { get; set; }
* public string MyProperty { get; set; }
*
* If you add a property and using the EF Core, remember these;
*
* 1. update DukkantekDbContext.OnModelCreating
* to configure the mapping for your new property
* 2. Update DukkantekEfCoreEntityExtensionMappings to extend the IdentityUser entity
* and add your new property to the migration.
* 3. Use the Add-Migration to add a new database migration.
* 4. Run the .DbMigrator project (or use the Update-Database command) to apply
* schema change to the database.
*/
public virtual ICollection<Customer> Customers { get; set; }
private AppUser()
{
}
}
Now my AppUser has a one to many relationship with Customer -- > ** public virtual ICollection<Customer> Customers { get; set; } **
** and in my Customer Class:**
public class Customer : AuditedAggregateRoot<Guid>, ISoftDelete
{
[Required]
[StringLength(50)]
public string Name { get; set; }
[StringLength(15)]
public string Phone { get; set; }
public Guid UserId { get; set; }
public virtual AppUser User { get; set; }
My DbContexts OnModelCreating :
protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder);
/* Configure the shared tables (with included modules) here */
builder.Entity<AppUser>(b =>
{
b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users"); //Sharing the same table "AbpUsers" with the IdentityUser
b.HasMany(p => p.Customers).WithOne().HasForeignKey(r => r.UserId);
b.ConfigureExtraProperties();
b.ConfigureByConvention();
b.ConfigureAbpUser();
/* Configure mappings for your additional properties.
* Also see the DukkantekEfCoreEntityExtensionMappings class.
*/
});
** DukkantekDbContextModelCreatingExtensions**
builder.Entity<Customer>(b =>
{
b.ToTable(DukkantekConsts.DbTablePrefix + "Customers", DukkantekConsts.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
});
** DukkantekEfCoreEntityExtensionMappings** public static void Configure() { DukkantekGlobalFeatureConfigurator.Configure(); DukkantekModuleExtensionConfigurator.Configure();
OneTimeRunner.Run(() =>
{
* See the documentation for more:
* https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
*/
ObjectExtensionManager.Instance.MapEfCoreProperty<IdentityUser, ICollection<Customer>>("Customers");
});
}
I feel like this line is probably the issue : ObjectExtensionManager.Instance.MapEfCoreProperty<IdentityUser, ICollection<Customer>>("Customers");
so how do i map IdentityUser to an ICollection of Customers ?? would really appreciate your support on this
HI team, I purchased ABP Commercial and to be honest so far, every step of the way i had an issue. The current issue i am stuck on is when i try to login as a tenant.
So far : i created few Tenants :
then i ran Dbmigrator Project :
successfull
Databases Created :
All good.
try and login as the new Tenant :
Cant login : i get this Invalid Grant error no matter what i do.
Hi team, Iam Trying to create a navigation property for Appuser from my entity so i can include the name of the creator in the front end : i read the documentation and it said something about maping it or ignoring it , but i dont understand what to do exactly
My entity :
{ public class InventoryAdjustmentLog : AuditedEntityWithUser<Guid,AppUser> {
public InventoryAdjustmentLog()
{
}
public int CurrentStockLevel { get; set; }
public int AdjustedStockLevel { get; set; }
public Guid? ReasonId { get; set; }
public virtual Reason Reason { get; set; }
public Guid ProductId { get; set; }
public virtual Product Product { get; set; }
}
}
How can i implement this without getting this error :
---- System.InvalidOperationException : The property 'AppUser.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
Message:
Volo.Abp.AbpInitializationException : An error occurred during ConfigureServices phase of the module Dukkantek.EntityFrameworkCore.DukkantekEntityFrameworkCoreTestModule, Dukkantek.EntityFrameworkCore.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---- System.InvalidOperationException : The property 'AppUser.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
Stack Trace:
AbpApplicationBase.ConfigureServices()
AbpApplicationBase.ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) AbpApplicationWithExternalServiceProvider.ctor(Type startupModuleType, IServiceCollection services, Action
1 optionsAction)
AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action1 optionsAction) AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action
1 optionsAction)
ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action1 optionsAction) AbpIntegratedTest
1.ctor()
DukkantekTestBase1.ctor() DukkantekApplicationTestBase.ctor() InventoryAppServiceTests.ctor(ITestOutputHelper Output) line 23 ----- Inner Stack Trace ----- ModelValidator.ValidatePropertyMapping(IModel model, IDiagnosticsLogger
1 logger)
ModelValidator.Validate(IModel model, IDiagnosticsLogger1 logger) RelationalModelValidator.Validate(IModel model, IDiagnosticsLogger
1 logger)
SqliteModelValidator.Validate(IModel model, IDiagnosticsLogger1 logger) ValidatingConvention.ProcessModelFinalized(IConventionModelBuilder modelBuilder, IConventionContext
1 context)
ImmediateConventionScope.OnModelFinalized(IConventionModelBuilder modelBuilder)
ConventionDispatcher.OnModelFinalized(IConventionModelBuilder modelBuilder)
Model.FinalizeModel()
ModelBuilder.FinalizeModel()
ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder)
ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder)
DbContextServices.CreateModel()
DbContextServices.get_Model()
<>c.<TryAddCoreServices>b__7_3(IServiceProvider p)
CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) CallSiteVisitor
2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) CallSiteVisitor
2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
ServiceProviderEngineScope.GetService(Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
DbContext.get_DbContextDependencies()
DbContext.get_InternalServiceProvider()
IServiceProvider>.get_Instance()
InfrastructureExtensions.GetService[TService](IInfrastructure1 accessor) AccessorExtensions.GetService[TService](IInfrastructure
1 accessor)
DukkantekEntityFrameworkCoreTestModule.CreateDatabaseAndGetConnection() line 56
DukkantekEntityFrameworkCoreTestModule.ConfigureInMemorySqlite(IServiceCollection services) line 29
DukkantekEntityFrameworkCoreTestModule.ConfigureServices(ServiceConfigurationContext context) line 25
AbpApplicationBase.ConfigureServices()
Hi Team, I want to automatically generate a connectionstring when a new tenant is created , however since i dont have the source code for tenantappserivce, how can i override it ? or what is the solution in my case ?
Cheers, Fathi CTO
Hi team, I wanted to ask you about a couple things. I have a blazor app running using the abp template. I am using the default authentication using the OPENID .
what is the advantage of using OPENID vs regular JWT token and attaching to the header ?
how can i change the behaviour of logging out --> going to a page that says i will be redirected ---> going to a page that says "Logged out" ??
at the moment, the redirect after i log out takes me to https://app.promailnet.com/authentication/logged-out , but i want it to go back to the login screen.
is there a way to user regular JWT ?
ABP Framework version: v4.2.2 UI type: Blazor DB provider: EF Core / Tiered (MVC) or Identity Server Separated (Angular): no
Hi Team, i currently have multitenant database per tenant implementation for one of my projects. The scenario is as follows:
Its a supermarket management SaaS, i have one host database and around 400 Databases for the tenants. 1 database per supermarket.
Now i am currently creating a customer mobile app in which the customers can order from the supermarkets. So the user registers and that creates a user in the host database, the user logs into the app then chooses a supermarket to place the order . When the user creates an order, this will create a new order in the relavant database. However, some tables have audited entities, how will the userId be carried over to the tenant database ? do i have to create the user again in the relevant database or how do i navigate such a situation ?
I hope you understand the situation, let me know if you have any questions .
Dear team, is there a faster way to run DBMigrator on 1000+ Tenants ? its currently taking hours to finish as it loops through all the tenants one by one, i understand that. But this strategy is causing us to have downtimes when we do schema updates.
Is there a way to keep the system running while migration is running ? is there a faster way to migrate this many databases ? can i migrate them back to a single database ?
ABP Framework version: v4.2.2 UI type: / Blazor DB provider: EF Core / Tiered (MVC) or Identity Server Separated (Angular): no
i am trying to create a UI inwhich when the user registers using his phone number, the backend autogenerates the password and should return a JWT token ( Same one we get when we authenticate using connect/token endpoint.
How can i authenticate and get a token in the backend programatically so ican send it as a response. ??
public virtual async Task<string> LoginOrRegister(LoginInputDto input) { await CheckSelfRegistrationAsync();
await IdentityOptions.SetAsync();
var user = new IdentityUser(GuidGenerator.Create(), input.PhoneNumber, input.PhoneNumber + "@dukkantek.com", CurrentTenant.Id);
user.SetPhoneNumber(user.UserName,true);
(await UserManager.CreateAsync(user, "#Pp" + input.PhoneNumber)).CheckErrors();
(await UserManager.AddDefaultRolesAsync(user)).CheckErrors();
var token = //code to login this new user and Generate token
return token;
}
hello, i have a products entity , each product can have a product category and product subcategory. in some situations, the product exists in the tenant but the category and sub category only in the host.
i created a custom repository where i have this code where i implemenet datafilter to get host product categories and sub categories :
this unfortunately doesnt work and keeps returning null values for the product category and subcategory. i checked the response in GetHostProductCategories() function and shows the data there if do a .ToList().
I am tring to eventually achieve functionality where if the product category is not in this tenant, then we get it from host..
PS: BOTH TENANT AND HOST ARE IN THE SAME DATABASE
public virtual async Task<IQueryable<ProductWithNavigationProperties>> GetQueryForNavigationPropertiesAsync(
Guid? tenantId=null)
{
var products = (await GetDbSetAsync());
return from product in (products)
join productCategory in await GetHostProductCategories()
on product.ProductCategoryId equals productCategory.Id into productCategories
from productCategory in productCategories.DefaultIfEmpty()
join productSubCategory in await GetHostProductSubCategories()
on product.ProductSubCategoryId equals productSubCategory.Id into productSubCategories
from productSubCategory in productSubCategories.DefaultIfEmpty()
select new ProductWithNavigationProperties()
{
Product = product,
ProductCategory = productCategory,
ProductSubCategory = productSubCategory,
};
}
private async Task<IQueryable<ProductCategory>> GetHostProductCategories()
{
using (DataFilter.Disable<IMultiTenant>())
{
return (await GetDbContextAsync()).ProductCategories;
}
}
private async Task<IQueryable<ProductSubCategory>> GetHostProductSubCategories()
{
using (DataFilter.Disable<IMultiTenant>())
{
return(await GetDbContextAsync()).ProductSubCategories;
}
}