aspnetboilerplate

DbContext per request aspboilerplate

左心房为你撑大大i 提交于 2021-01-28 14:20:48
问题 I need to implement multithreading background job for import file. I have implemented it with background job(Hangfire). But if i use one thread it goes very slow. The function look like this. I using non-transaction unit to save changes to db immediately. var contactFound = await _contactRepository.FirstOrDefaultAsync(x => x.Email.ToLower() == contact.Email.ToLower()); if (contactFound != null) { await _bjInfoManager.AddLog(args.JobId, "Found duplicated email: " + contact.Email); } else {

Property Injection for NRules within ABP

允我心安 提交于 2021-01-07 02:37:54
问题 I am using ABP Boilerplate 6.0 and have integrated NRules with our platform. I am able to get the rule below to work, but the issue is that I cannot use the injected ‘_questionResponseRepository’ within the rule condition, because only after the rule criteria are met, does the resolution of dependencies take place. I would like to use ‘_questionResponseRepository’ to get from the database a list of keywords and use those words in the Rule match condition The Calling code public

ASP.NET BoilerPlate: How do I inject object of DbContext in application service?

亡梦爱人 提交于 2020-12-06 15:57:16
问题 How do I inject object of DbContext in application service? Need to access it to create clone of a entity record. 回答1: You can use IDbContextProvider<TDbContext> _sampleDbContextProvider as constructor injection, using with _sampleDbContextProvider.GetDbContext(); 回答2: One tricky way to clone an entity is just serialize and then deserialize the object. Use Newtonsoft for serialization. Simply this code can be used MyEntity myEntity = _myEntityRepository.get(1); string cloned = JsonConvert

Why doesn't cookie ExpireTimeSpan setting work?

十年热恋 提交于 2020-12-06 07:00:09
问题 I used: services.AddAuthenticationCore().ConfigureApplicationCookie(o => { o.ExpireTimeSpan = TimeSpan.FromHours(1); o.SlidingExpiration = true; }); to set my authentication cookie ExpireTimeSpan in Startup.cs in ASP.NET Core MVC project. I can see that the cookie expire-time has been set correctly in the web browser after login, but it auto logout after 30 minutes every time, even if I refresh the website every 10 seconds. If I set the ExpireTimeSpan less than 30 minutes, it can timeout

Database operation expected to affect 1 row(s) but actually affected 0 row(s)

放肆的年华 提交于 2020-08-27 06:06:50
问题 I'm trying to insert records in two tables, but getting the exception. Could you please help me to resolve the issue. First I tried the below code. await _testRepository.InsertAsync(test); await _xyzRepository.InsertAsync(xyz); Then I tried this code, But nothing is working for me. try { var test = new Test(); using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) { int? tenantId = _unitOfWorkManager.Current.GetTenantId(); using (_unitOfWorkManager.Current.SetTenantId

ASP.NET Boilerplate + IdentityServer

那年仲夏 提交于 2020-08-22 06:26:51
问题 I tried to implement IdentityServer as it is explained at https://aspnetboilerplate.com/Pages/Documents/Zero/Identity-Server But the sample does not work. I started a Core 2.0 Angular project from ASP.NET Boilerplate. Is there any updated working sample based on the documentation? There is more than one problem, but one of them is with AuthConfigurer.cs . The API caller (client) cannot pass the token validation. Actually, there is a token generation code in TokenAuthController.cs : private

ASP.NET Boilerplate + IdentityServer

霸气de小男生 提交于 2020-08-22 06:25:39
问题 I tried to implement IdentityServer as it is explained at https://aspnetboilerplate.com/Pages/Documents/Zero/Identity-Server But the sample does not work. I started a Core 2.0 Angular project from ASP.NET Boilerplate. Is there any updated working sample based on the documentation? There is more than one problem, but one of them is with AuthConfigurer.cs . The API caller (client) cannot pass the token validation. Actually, there is a token generation code in TokenAuthController.cs : private