structuremap

How do you Resolve signalR v2.0 with StructureMap v2.6

匆匆过客 提交于 2020-01-02 09:32:07
问题 In Application_Start of Global.asax i have the following ObjectFactory.Initialize(cfg => { cfg.For<IDependencyResolver>().Singleton().Add<StructureMapDependencyResolver> (); }); My Interface for the Hub is public interface IDashboardHub { void Initialize(); } and my hub is as follows: public class DashboardHub : Hub, IDashboardHub { private readonly ICpeAccountService _accountService; public DashboardHub(ICpeAccountService service) { _accountService = service; } [Authorize] public void

What is the equivalent of HybridHttpOrThreadLocalScoped in structure map 3?

天涯浪子 提交于 2020-01-02 00:54:10
问题 With structuremap 2.6.4.1 my container is configured like this: existingContainer.Configure(expression => { expression.For<IDocumentSession>() .HybridHttpOrThreadLocalScoped() .Use(container => { var store = container.GetInstance<IDocumentStore>(); return store.OpenSession(); }); } HybridHttpOrThreadLocalScoped does not exist in structure map 3 so my question is, what is the equivalent configuration in structuremap 3? 回答1: As of StructureMap 3, anything HttpContext related lives within a

How can I configure Structuremap to auto scan type in Assembly and Cache by Singleton?

元气小坏坏 提交于 2020-01-01 09:37:25
问题 I am using mvc.net with StructureMap to scan and register all repositories and services for me. Now I want to register and cache by Singleton. How can I do? IContainer container = new Container(x => { // Register Repositories and Services x.Scan(y => { y.AssemblyContainingType<SomeRepository>(); y.AssemblyContainingType<SomeService>(); y.IncludeNamespaceContainingType<SomeRepository>(); y.IncludeNamespaceContainingType<SomeService>(); }); // Register Controllers x.Scan(y => { y

Dependency Injection and development productivity

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 02:29:18
问题 Abstract For the past few months I have been programming a light weight, C# based game engine with API abstraction and entity/component/scripting system. The whole idea of it is to ease the game development process in XNA, SlimDX and such, by providing architecture similar to that of the Unity engine. Design challenges As most game developers know, there are a lot of different services you need to access throughout your code. Many developers resort to using global static instances of e.g. a

StructureMap error when invalid controller

非 Y 不嫁゛ 提交于 2019-12-30 23:14:52
问题 I am using Structure map like the MVC storefront by Rob Conery does and I have an AdminController and so to get to it I just type: website/Admin/action however if I miss spell the controller name I get the error below: Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: key There error occurs on this line: Controller controller = ObjectFactory.GetInstance(controllerType) as Controller; Does anyone have any ideas on how I can handle this error or not allow it

StructureMap error when invalid controller

邮差的信 提交于 2019-12-30 23:14:46
问题 I am using Structure map like the MVC storefront by Rob Conery does and I have an AdminController and so to get to it I just type: website/Admin/action however if I miss spell the controller name I get the error below: Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: key There error occurs on this line: Controller controller = ObjectFactory.GetInstance(controllerType) as Controller; Does anyone have any ideas on how I can handle this error or not allow it

Getting Fluent NHibernate To Build Database tables

心不动则不痛 提交于 2019-12-30 14:42:15
问题 I am building an app with ASP.NET MVC2, Fluent NHibernate, StructureMap, and PostgreSQL. I am a total newbie when it comes to Fluent NHibernate. I got a setup going from a couple different sources but when I build and run my app it doesnt create the database tables for the database in my connection string. I have code in a few different files so Im not sure which code I need to post of if I should post all of it. If there is one key to check for please let me know or let me know to post all

Getting Fluent NHibernate To Build Database tables

血红的双手。 提交于 2019-12-30 14:41:01
问题 I am building an app with ASP.NET MVC2, Fluent NHibernate, StructureMap, and PostgreSQL. I am a total newbie when it comes to Fluent NHibernate. I got a setup going from a couple different sources but when I build and run my app it doesnt create the database tables for the database in my connection string. I have code in a few different files so Im not sure which code I need to post of if I should post all of it. If there is one key to check for please let me know or let me know to post all

“No IUserTokenProvider is registered” when using structuremap dependency injection

拈花ヽ惹草 提交于 2019-12-30 09:47:29
问题 I have an MVC 5 project that has been modified to use int as the primary key for identity as shown in this guide I then enabled email confirmation as described in this guide Everything worked fine as expected. Then I installed structuremap.mvc5 for dependency injection and added modified DefaultRegistry.cs to public DefaultRegistry() { Scan( scan => { scan.TheCallingAssembly(); scan.WithDefaultConventions(); scan.AssemblyContainingType(typeof(MyProject.Data.MyDbContext)); scan.With(new

StructureMap Exception Code: 202 No Default Instance defined for PluginFamily

為{幸葍}努か 提交于 2019-12-25 16:51:51
问题 I'm new to StuctureMap and I am writing a WCF service. In the existing code the previous developer used SturctureMap. I get this error: StructureMap Exception Code: 202 No Default Instance defined for PluginFamily MyCompany.SMS.Data.DataEntitys, MyCompany.SMS.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Here is the Code: class a { method aa { var db = ObjectFactory.GetInstance<nsclaimsEntities>(); } } When we are calling this code from an aspx.cs file it is working fine without