I have created a new entity and it's respective page, models, and app service in a separate project and then manually moved every artifact into my project. The entity listing and crud operations were working perfectly fine in the separate project where I actually generated it, however, the issue started arising when I moved all the artifacts into my main project. All looks good, except I cannot locate app service in my entity-page's index.js file. My entity name is agencyCustomer and when I go in index.js file, the code fails at:
var agencyCustomerService = window.iosIdentity.pS3.agencyCustomers;
The error says iosIdentity.pS3 is undefined or null, while I can see the namespace is there with the app service. I'm unsure about why the error is coming. I have made sure all the code files are moved properly with every change carefully checked, but stuck on the above error. Any idea what could have gone wrong here?
Thanks, Moin
Is there a way to extend existing system entities (IdentityUser, OrganizationUnit, IdentityRole) with an interface? I'm trying to add customer data filters through ABP EF Core's Global Query Filters system. I can easily extend my custom entities but how to do existing system entities. I read about ObjectExtensionManager to add new properties but don't know how to use (if there's a possibility) to extend with an interface?
Is there a way to override the current dbcontext and call another for an specific App Service?
I have extended the AbdDbContext and overriding CreateFilterExpression method to inject additional database filtering only for the case of IdentityUserAppService. All looks good, but I'm unsure how to route the database calls through this new Extended dbcontext, any idea?
I need to add a new Menu item in Administration > Identity Management. How can I do that?
Thanks, Moin
The actual ask is I'd like to extend IdentiyUser model to add departments functionality just as we have for roles in the same table. I need a collection out there with all CRUD methods.
I'm trying to create a new entity (Department) as follows: Entity name: Department
| Name | DataType | Remarks | | ---- | -------- | ------- | | Id | Uniqueidentifier | Primary Key | | Name | NVarchar(255) | Department name | | OrganizationUnitId (FK) | UniqueIdentifier | Foreign key from OrganizationUnit entity |
How can I achieve this? Also, how to add Collection property (Departments) in OrganizationUnity entity?
Thanks, Moin
It didn't work; I tried a new project too. Were you able to reproduce at your end?
Our cache needs are very limited and in-memory/in-process is sufficient for it; that's why do not want to try Redis.
I'm sharing the code below; removing/obfuscating many things for privacy but have included bare-minimum set that give you a clear idea.
Here's module code:
[DependsOn(
typeof(AbpAutoMapperModule),
typeof(AbpCachingModule)
)]
public class CustomModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpAutoMapperOptions>(options => {
options.AddMaps<CustomModule>();
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var service = context
.ServiceProvider
.GetRequiredService<CustomInit>();
service.Initialize();
}
}
Init class:
public class CustomInit : ISingletonDependency
{
private IDistributedCache<CacheItem> _cache;
public CustomInit(
IDistributedCache<CacheItem> cache)
{
_cache = cache;
}
public void Initialize()
{
// load records from API
var records = client.Records.GetAllAsync(request).Result;
// initialize abp cache
foreach (var rec in records) {
_cache.SetAsync(
rec.Id, // Cache key
new CacheItem { Id = rec.Id, Name = rec.Name }, // Cache value
new DistributedCacheEntryOptions { SlidingExpiration = TimeSpan.FromDays(1000) } // Cache options
);
}
}
}
Service class where I'm accessing cache:
public class CustomService : ApplicationService, ICustomService, ITransientDependency
{
private IDistributedCache<CacheItem> _cache;
public CustomService(
IDistributedCache<CacheItem> cache)
{
_cache = cache;
}
public async Task<CacheItem> GetAsync(string id)
{
var rec = await _cache.GetAsync(id); // rec is always null
return rec;
}
}
Hi,
Can we share/access cache across services? I have a service that initializes the cache upon module load, but when I access the same cache into another service I always get a cache miss. I have thoroughly verified that the cache is getting initialized but items not accessible from the other service. Is this a default behavior or am I missing something? If it is something by design how can we overcome this?
Thanks, Moin