public BranchUOW(Func<FoodieTenantContext,BranchRepository> branchRepository,
Func<FoodieTenantContext, BranchContactRepository> branchContactRepository,
FoodieTenantContext ctx, IMapperService mapperService)
: base(ctx)
{
_ctx = ctx;
_branchRepository = branchRepository(ctx);
_branchContactRepository = branchContactRepository(ctx);
_mapperService = mapperService;
}
分支机构看起来像
public BranchRepository(FoodieTenantContext ctx)
: base(ctx)
{
}
尝试了下面的排列
container.Register(
Component.For<Func<FoodieTenantContext, BranchRepository>>()
.ImplementedBy(typeof(IRepository<BranchRepository>))
.LifestyleTransient()
);
container.Register(
Component.For<Func<FoodieTenantContext, BranchContactRepository>>()
.ImplementedBy(typeof(IRepository<BranchContactRepository>))
.LifestyleTransient()
);
但无法立即抛出以下错误。
键入foodie.common.repository.irepository
1[[foodie.tenant.EF.Repository.Domain.BranchRepository, foodie.tenant.EF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] is abstract.\r\n As such, it is not possible to instansiate it as implementation of service 'foodie.common.Repository.IRepository
1[[foodie.tenant.ef.repository.domain.branchrepository,foodie.tenant.ef,version=1.0.0.0,culture=neutral,publickeytoken=null]]'。你忘了代理吗?
谢谢。