structuremap

Setting up Fluent NHibernate and StructureMap for a web application

不羁岁月 提交于 2019-12-25 11:56:07
问题 I use this approuch http://www.kevinwilliampang.com/2010/04/06/setting-up-asp-net-mvc-with-fluent-nhibernate-and-structuremap/ for setting up fnh with structuremap but after one request I get the following exception Session is closed! Object name: 'ISession'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System

Aspect Oriented Programming with StructureMap.DynamicInterception

那年仲夏 提交于 2019-12-25 08:43:13
问题 I implemented a console app that uses DynamicInterception on structure map, I follow the example on the page StructureMap DynamicInterception. Now I'm trying to pass the code to a asp.net MVC site but I get the following error Decorator Interceptor failed during object construction. See the inner exception: 1.) DynamicProxyInterceptor of ITSector.Site.Core.Controllers.HomeController with interception behaviors: ITSector.Library.Aspect.LoggerInterceptor 2.) ITSector.Site.Core.Controllers

MVC 2.0 - different view based on URL with shared controls

烂漫一生 提交于 2019-12-24 18:43:23
问题 I have 2 master pages. One is intended to be shown in a normal standalone website. The other is to be used in external sites as an Iframe. I want to be able to show the normal page at http://example.com/home/index and the iframed version at http://example.com/framed/home/index I want to have controls that will postback to one controller so I don't have to duplicate logic, so they must be available in both the normal and iframed versions. My problem is that when I try and use areas, I just can

StructureMap and SignalR - IMessageBus, no default instance defined

丶灬走出姿态 提交于 2019-12-24 13:02:52
问题 I used nuget to update my project to signalr 2.2 and structure map 2.6.4. Now when my program attempts to use SignalR, structure map is throwing this error: StructureMap.StructureMapException was unhandled by user code HResult=-2146232832 Message=StructureMap Exception Code: 202 No Default Instance defined for PluginFamily Microsoft.AspNet.SignalR.Messaging.IMessageBus, Microsoft.AspNet.SignalR.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Source=StructureMap My code

StructureMap and SignalR - IMessageBus, no default instance defined

回眸只為那壹抹淺笑 提交于 2019-12-24 12:55:27
问题 I used nuget to update my project to signalr 2.2 and structure map 2.6.4. Now when my program attempts to use SignalR, structure map is throwing this error: StructureMap.StructureMapException was unhandled by user code HResult=-2146232832 Message=StructureMap Exception Code: 202 No Default Instance defined for PluginFamily Microsoft.AspNet.SignalR.Messaging.IMessageBus, Microsoft.AspNet.SignalR.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Source=StructureMap My code

Structure Map - Collection of Dependencies in Constructor

こ雲淡風輕ζ 提交于 2019-12-23 21:52:26
问题 I have the following code in my Registry: Scan(x => { x.Assembly(Assembly.GetExecutingAssembly()); x.AddAllTypesOf<IXmlExtractor>(); }); This code adds all instances of IXmlExtractor in my assembly to the IoC container. Now I want to use all found instances in my class, but I prefer to inject via constructor than to use ObjectFactory in a method. Hopefully code below illustrates what I want to do: class Engine : IEngine { private readonly ILog _logger; private readonly ICurveConfigRepository

StructureMap: How to register the same instance for all its interfaces

梦想与她 提交于 2019-12-23 08:58:52
问题 StructureMap newbie question. public class SomeClass: IInterface1, IInterface2 { } I would like the following test to pass: Assert.AreSameInstance( container.GetInstance<IInterface1>(), container.GetInstance<IInterface2>()); How would I do an explicit registration of this? I know in Castle Windsor I would do something like kernel.Register(Component.For(typeof(IInterface1), typeof(IInterface2)) .ImplementedBy(typeof(SomeClass)); But I don't see any equivalent API 回答1: ObjectFactory.Initialize

StructureMap singleton

吃可爱长大的小学妹 提交于 2019-12-22 09:29:27
问题 Are these two equivalent? 1) var store = new DocumentStore(); For<IDocumentStore>().Use(store); 2) var store = new DocumentStore(); For<IDocumentStore>().Singleton().Use(store); or For< IDocumentStore>().AlwaysUnique().Use(store); Will both of these return singleton instance of documentstore with no duplicate instances? 回答1: You will always get singleton behavior when you provide an instance instead of just a type. 回答2: AlwaysUnique() does the opposite and always creates a unique(new)

MVVM and StructureMap usage

社会主义新天地 提交于 2019-12-22 08:19:05
问题 I have quite a large number of parent-detail ViewModels in my MVVM application. Something like this: SchoolsViewModel +- SchoolViewModel +- LessonViewModel +- PupilsViewModel +- PupilViewModel +- TeacherViewModel +- PupilsViewModel +- PupilViewModel +- LessonsViewModel +- TeachersViewModel And so on... In addition, a single view model can appear in more than one place, depending on whether the user is browsing by lesson or pupil, etc. Each child view model is created by the parent view model,

Structuremap and generic types

不羁岁月 提交于 2019-12-22 08:12:44
问题 I have a situation which seems a bit different from others I've seen. For clarrification, this isn't the normal question eg; something like IAClass maps to AClass etc - that involves using basically a single concrete classes per interface. This involves having a single generic class, but I want to be able to load ALL possible usages of it. Eg - the main class is of public class MyClass<TDomainObject> : IMyClass<TDomainObject> where TDomainObject : DomainObject So example usages would be