Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "aaron"

Answer

What is your:

  • use case, and
  • expected behavior?

Have you added both DbContexts like in this comment: https://github.com/aspnetzero/aspnet-zero-core/issues/372#issuecomment-327497309

Add this namespace:

using Abp.Configuration.Startup;

Switch to DbContext transaction API in PreInitialize method of YourEntityFrameworkModule:

Configuration.ReplaceService<IEfCoreTransactionStrategy, DbContextEfCoreTransactionStrategy>(DependencyLifeStyle.Transient);

It is a collection navigation property. Use EnsureCollectionLoadedAsync.

Answer

You definitely should not do that, as CreatorUserId is handled by ABP. You can implement and manage your own CreatorUserName property.

Answer

Your solution is not good because i have to get all data from model A first.

What do you mean? That's what your code does.

Do you have other solution to implement join entities on multiple dbcontext?

Maybe you can use a stored procedure and a linked server, but I can't help with that.

Answer

DbContextEfTransactionStrategy simply uses the same transaction for multiple DbContexts. You can't join entities from multiple DbContexts.

For that specific query, you can do this:

var bModelCodes = _modelB.GetAll().Select(b => b.modelCode).ToList();
var aModels = _modelA.GetAll().Where(a => bModelCodes.Contains(a.modelCode)).ToList();

You need to login with your GitHub account to access the private repo. You can invite yourself here: <a class="postlink" href="https://aspnetzero.com/LicenseManagement">https://aspnetzero.com/LicenseManagement</a>

It's in the link. Reproduced here:

configure it in PreInitialize method of YourProjectNameDataModule like that:

Configuration.ReplaceService<IEfTransactionStrategy, DbContextEfTransactionStrategy>(DependencyLifeStyle.Transient);
Showing 1321 to 1330 of 1543 entries