1
나는SharpRepository를 AutoFac 및 Entiry Framework와 함께 사용하려면 어떻게 설정해야합니까?
SharpRepository.EfRepository
SharpRepository.Ioc.Autofac
SharpRepository.Repository
설치하고 Autofac 문서의 지시에 따라 나는 설정 Autofac이 코드를 추가 한 :
void SetupAutofac()
{
var builder = new ContainerBuilder();
// Get your HttpConfiguration.
HttpConfiguration config = GlobalConfiguration.Configuration;
// Register your Web API controllers.
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
// OPTIONAL: Register the Autofac filter provider.
builder.RegisterWebApiFilterProvider(config);
// Set the dependency resolver to be Autofac.
IContainer container = builder.Build();
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
}
하지만 SharpRepository가 Autofac 나에게 도움이되지 않습니다 가이드를 시작하기 - -> EF -> SharpRepo는 StructureMap을 지향하므로 접착제를 사용합니다. 제발 조언!
(I 가능한 경우의 Web.config에 물건을 넣어하지 않도록하고 싶습니다)