StructureMap:没有默认实例注册,因此无法自动确定

我在全局中使用此代码

my_points[:,i]

但在 protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(Routetable.Routes); BundleConfig.RegisterBundles(Bundletable.Bundles); setDbInitializer(); IContainer container = new Container(); container.Configure(c => { c.IncludeRegistry<BusinessRegistry>(); }); ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); } protected void Application_EndRequest(object sender,EventArgs e) { HttpContextLifecycle.DisposeAndClearAll(); } public class StructureMapControllerFactory : DefaultControllerFactory { protected override IController getcontrollerInstance(RequestContext requestContext,Type controllerType) { if (controllerType == null) throw new InvalidOperationException(string.Format("Page not found: {0}",requestContext.HttpContext.Request.RawUrl)); return SmObjectFactory.Container.GetInstance(controllerType) as Controller; } } private static void setDbInitializer() { Database.SetInitializer(new MigrateDatabaseToLatestVersion<BehticketContext,Configuration>()); SmObjectFactory.Container.GetInstance<IUnitOfWork>().ForceDatabaseInitialize(); } 中出现错误

SmObjectFactory.Container.GetInstance<IUnitOfWork>().ForceDatabaseInitialize()
iCMS 回答:StructureMap:没有默认实例注册,因此无法自动确定

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/1961326.html

大家都在问