FWIW - Have you tried creating DTO objects then firing into a seperate UOW function that maps to your enity then creates?
I've found myself stepping "outside the EF bubble" with DTO objects sometimes, both for speed and tracking issues.
And thanks for the AutoDetectChangesEnabled tip - never tried that.
Speaking of - if you comment that out while debugging - do you get more information?
I was eventually able to figure it out.
The documenation screenshots are the older Azure interface.
Basically - the steps now are to create the service plan, add a sql box, add a database, add an app service, connect and to migration / update-database, then in visual studio (for me anyway) publish and it will pick up everything on your Azure account.
In your catch, if you comment out the throw, does it still happen?
The current AZURE documentation is outdated.
I'm trying to figure out how to setup web app + sql and it's all different now.
Never mind - It's already there! :)
I have a mix of tenants, and I'd like to make two factor optional per tenant.
Is there a way to do this at host level, then override it at tenant level, allowing the "enable two factor" by disabling the override?
What would be the best approach to accomplish this?
8.9 Core / jQuery
I have a background job that runs for all tenants and sends an email to them.
When it tries to notify i get the error Must set LocalizationSourceName before...
I need to not only resolve this - but as I go through tenants, get their localization setting.
My worker class is basedon PeriodicBackgroundWorkerBase.
To send the email, it calls a method in a different class - my own emailer class, which inherits from workServiceBase, IUserEmailer, ITransientDependency
Thus, two questions -
1- How can I use localization in a class based on PeriodicBackgroundWorkerBase
and
2- Since I'm calling a function for different tenants, how do I change localization for each tenant as I go through them?
Thanks!
I'd just rip what you can out of ABP and modify it as needed.
One challenge might be your dbcontext doesn't know anything about AbpNotifications. Maybe add that class to your Core project, add it to your Context as a DbSet. I've never tried to lift one of these into ANZ from ABP, so YMMV.
Inject the repo into your worker, then get the database context. (Available for workers in the Applications domain, btw). With db context, you have a lot of flexibilty on how to address it.
If you want to do this across tenants, clear the tenant filter (you'll find that easily, just search this forum or see below) and do it in a unit of work.
Then just use linq to sql to delete.
I don't use BatchDeleteAsync, but it exists, but maybe something like this might work? (assuming you injected the repo as _notificationRepository.
I also noticed that the NotificationInfo class has a constant of AllTenantIds ('0") and an audited entity.
[UnitOfWork]
public async void purge(Int days = 7)
{
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
{
DateTime _n = Clock.Now.Date.AddDays(-1 * days); // 7 days prior to start of today be default
await _notificationRepository.BatchDeleteAsync(n => n.CreationTime < _n); // asta-la-vista
}
}
FWIW - I'd check the BatchDeleteAsync calls in ABP. Sometimes, I feel like ANZ and ABP db activity could be optimized a bit, in which case seeing if you could get your context to see the AbpNotifications table in your project, and manipulate it directly, might help.
In the end - I try and get such things as close to a simple sql call like "delete from AbpNotifications where CreationTime < x;"... which means something like https://docs.microsoft.com/en-us/ef/core/querying/raw-sql might be worth investigating.
If you go that route, I'd be interested to know if making your context aware of the that table worked.
HTH!
This looks cool!
Just curious - since Ionic is Angular based - wouldn't an angular version of the project be fairly straightfoward to port?
Also - do you use Native in your project?
Lastly - has anyone used https://github.com/thruthesky/abcframework to convert ANZ to a Cordova app?
FWIW - I ran into something similiar with DBContext and background jobs. I ended up putting my jobs in the Application project and was able to resolve.
Might be worth trying.