this code below is the reason when register dependencies
var builder = new ContainerBuilder();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
builder.RegisterApiControllers(typeof(UmbracoApplication).Assembly);
builder.RegisterType<Ta2healDbContext>().As<IUnitOfWork>().InstancePerReques();
builder.RegisterType<SubjectService>().As<ISubjectService>().InstancePerLifetimeScope();
builder.RegisterType<SectionService>().As<ISectionService>().InstancePerLifetimeScope();
builder.RegisterType<LessonService>().As<ILessonService>().InstancePerLifetimeScope();
// Set the dependency resolver to be Autofac.
var container = builder.Build();
var resolver = new AutofacWebApiDependencyResolver(container);
GlobalConfiguration.Configuration.DependencyResolver = resolver;
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
and this when i stop some code of register dependencies
it's work when i do this into register dependencies code
var builder = new ContainerBuilder();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
builder.RegisterApiControllers(typeof(UmbracoApplication).Assembly);
builder.RegisterType<Ta2healDbContext>().As<IUnitOfWork>().InstancePerRequest();
builder.RegisterType<SubjectService>().As<ISubjectService>().InstancePerLifetimeScope();
builder.RegisterType<SectionService>().As<ISectionService>().InstancePerLifetimeScope();
builder.RegisterType<LessonService>().As<ILessonService>().InstancePerLifetimeScope();
// Set the dependency resolver to be Autofac.
//var container = builder.Build();
//var resolver = new AutofacWebApiDependencyResolver(container);
//GlobalConfiguration.Configuration.DependencyResolver = resolver;
//DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
but code that i stopped make some problem to me
so i ask you if anyone have idea what can i do to solve this problem?
object reference not set to an instance of an object
Hi Dears,
i post you this error before Here https://our.umbraco.org/forum/developing-packages/80623-object-reference-not-set-to-an-instance-of-an-object but i found the problem but i cannot solved
this code below is the reason when register dependencies
and this when i stop some code of register dependencies
it's work when i do this into register dependencies code
but code that i stopped make some problem to me so i ask you if anyone have idea what can i do to solve this problem?
is working on a reply...