我在 .net core 下有一个项目。我想用 Castlewindosr 注册 Ef Core Context 但是我在 .net core 中找不到 EfCore Wireup 上下文的解决方案。谢谢。
我已经将 Read Context 与 Write Now 分开了,默认情况下我将在 ReadOnlyContext 中启用 LazyLoading。我也用了下面的方法,可惜不行。
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseLazyLoadingProxies()
.UseSqlServer(@"Data Source=.;Initial Catalog=UniversityDb;Persist Security Info=True;User ID=admin;Password=asdasdsadasd");
}
Run Code Online (Sandbox Code Playgroud)
我的模型:
public class Partner : BaseEntity<int>
{
public string Name { get; set; }
public DateTime CreateDate { get; set; }
public bool IsDisabled { get; set; }
public bool IsDeleted { get; set; }
public virtual ICollection<PartnerUser> PartnerUsers { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的 ef 版本:
EntityFramework 核心 v 2.1.2
public async Task<PartnerQuery> Get(int …Run Code Online (Sandbox Code Playgroud) entity-framework lazy-loading entity-framework-core .net-core