castle-windsor

MvcContrib Windsor Setup Component With Parameter

微笑、不失礼 提交于 2019-12-24 05:58:05
问题 I am using the MvcContrib library with Castle Windsor and I am having a problem with setting a parameter when I register a component. I have the following interfaces for classes that wrap a DataContext. I want to be able to specify which DataContext to use for different services because I am connecting to several databases to retrieve data. public interface IDataContext { DataContext Context { get; } } public interface IReportingDC : IDataContext { } public class Repository<T> : IRepository<T

MvcContrib Windsor Setup Component With Parameter

戏子无情 提交于 2019-12-24 05:57:03
问题 I am using the MvcContrib library with Castle Windsor and I am having a problem with setting a parameter when I register a component. I have the following interfaces for classes that wrap a DataContext. I want to be able to specify which DataContext to use for different services because I am connecting to several databases to retrieve data. public interface IDataContext { DataContext Context { get; } } public interface IReportingDC : IDataContext { } public class Repository<T> : IRepository<T

Castle Windsor Map Named Component To Specific Property

前提是你 提交于 2019-12-24 05:03:07
问题 Following scenario: We use the Fluent API to register all components in an assembly and two components tyepof(A) with named keys. Another class B with two properties typeof(A) should get the named components injected. Sample: public class A : IA {} public class B : IB { [Named("first")] public IA First { get; set; } [Named("second")] public IA Second { get; set; } } // ... container.Register(Component.For<IA>().Instance(new A(value1)).Named("first")); container.Register(Component.For<IA>()

Castle Windsor Map Named Component To Specific Property

我的未来我决定 提交于 2019-12-24 05:02:04
问题 Following scenario: We use the Fluent API to register all components in an assembly and two components tyepof(A) with named keys. Another class B with two properties typeof(A) should get the named components injected. Sample: public class A : IA {} public class B : IB { [Named("first")] public IA First { get; set; } [Named("second")] public IA Second { get; set; } } // ... container.Register(Component.For<IA>().Instance(new A(value1)).Named("first")); container.Register(Component.For<IA>()

ASP.NET MVC 4 RC with Castle Windsor

自古美人都是妖i 提交于 2019-12-24 04:52:19
问题 I was taking a look at ASP.NET MVC 4 RC and cannot find DefaultHttpControllerFactory or even IHttpControllerFactory to allow my IoC container of choice (Castle Windsor) to hook into the framework for Web Api controllers. I ended up using IDependencyResolver which makes releasing components a bit trickier, but ended up with the following. Is it going to work / not memory leak until IDependencyResolver has a Release method? Global.asax ends up as: public class WebApiApplication : System.Web

Castle Windsor lifestyle in dotnet core web application

故事扮演 提交于 2019-12-24 04:24:10
问题 What lifestyle should be used to replace PerWebRequest when using the Castle Windsor MS Adapter? https://github.com/volosoft/castle-windsor-ms-adapter Before dotnet core I would use the PerWebRequest lifestyle for almost all of the components in the container. Now that we are disconnected from IIS modules and http context, I want to ensure my components are being created and disposed when the web requests starts and ends. Example: container.Register(Component.For<MyEntityFrameworkContext>)

Constructor on type: “Namespace.type” not found

浪尽此生 提交于 2019-12-24 03:53:23
问题 I am using Castle.Windsor as an IOC. So I am trying to resolve a service type in the constructor of an HTTPHandler. I keep receiving this error, " Constructor on type: "Namespace.type" not found. " My configuration has the following entries for service type: IDocumentDirectory <component id="restricted.content.directory" service="org.myorg.foundations.services.content.IDocumentDirectory, org.myorg.foundations.services" type="org.myorg.foundations.services.content

configuration file of castle windsor

半城伤御伤魂 提交于 2019-12-24 03:29:53
问题 that how my config file looklike: <?xml version="1.0" encoding="utf-8" ?> <configuration> <!--<configSections> <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" /> </configSections> <castle>--> <components> <component id="BasicElement" service="ClassLibrary1.ISomething, ClassLibrary1" type="ClassLibrary1s.Something, ClassLibrary1" lifestyle="singleton"> </component> </components> <!--</castle>--> </configuration> when I run my application

Initialise a class with a parameterized constructor in the constructor of a Service Class using Castle Windsor

拈花ヽ惹草 提交于 2019-12-24 03:03:02
问题 Please note that I have changed the code in the question. Please see the server side code below (WCF Service): using System.ServiceModel; using System.ServiceModel.Web; using System.Text; using Castle.MicroKernel.Registration; using Castle.MicroKernel.SubSystems.Configuration; using Castle.Windsor; namespace WcfService1 { public class WindsorInstaller : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register( Component.For<IGreeting

Wcf NHibernate Session management

六眼飞鱼酱① 提交于 2019-12-24 03:01:11
问题 I'm new to Castle, NHibernate and WCF. I implemented the session management for my MVC application based on the following article because it seemd to be the most advanced implementation of all posts I've read so far : http://nhibernate.info/blog/2011/03/02/effective-nhibernate-session-management-for-web-apps.html The only problem I got was that this uses some Asp.net specific functionality that isn't available in my WCF service like (HttpContext.Current.Items). I started to use WcfFacility