Search Results

Search found 1527 results on 62 pages for 'rob windsor'.

Page 1/62 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Castle Windsor Project Includes in Config

    - by Michael Edwards
    I want the properties section of the Castle config to be included from another file. I.e: <castle> <include uri="file://properties.config" /> </castle> The properties.config would then look like: <properties> <smtp>10.10.10.10</smtp> <username>john</username> </properties> I can get the include to work for components but not for properties. If I try to do this with properties I get an exception thrown. Is this a limitation of Castle?

    Read the article

  • Using Fluent NHibernate with Castle Windsor and the NHibernate Facility

    - by Andrew
    Ive managed to get Fluent NHibernate 1.1 playing nicely with Castle Windsor 2.1. This involved me recompiling NHibernate.ByteCode.Castle.dll and it all works fine. Ive managed to do the same thing this time with Castle Windsor 2.5, havent tried it yet but its not complaining which is good enough for me at the moment. However Im also using the Castle NHibernate Facility and that is another story. The version of the NHibernate Facility that is compatible with Castle 2.5 requires a much later version of NHibernate. Is there an easy way to get the NHibernate Facility to work with NHibernate 2.1 and Castle Core 2.5?

    Read the article

  • pooling with Windsor

    - by AlonEl
    I've tried out the pooling lifestyle with Windsor. Lets say I want multiple CustomerTasks to work with a pool of ILogger's. when i try resolving more times than maxPoolSize, new loggers keeps getting created. what am i missing and what exactly is the meaning of min and max pool size? the xml configuration i use is (demo code): <component id="customertasks" type="WindsorTest.CustomerTasks, WindsorTestCheck" lifestyle="transient" /> <component id="logger.console" service="WindsorTest.ILogger, WindsorTestCheck" type="WindsorTest.ConsoleLogger, WindsorTestCheck" lifestyle="pooled" initialPoolSize="2" maxPoolSize="5" /> Code is: public interface ILogger { void Log(string message); } public class ConsoleLogger : ILogger { private static int count = 0; public ConsoleLogger() { Console.WriteLine("Hello from constructor number:" + count); count++; } public void Log(string message) { Console.WriteLine(message); } } public class CustomerTasks { private readonly ILogger logger; public CustomerTasks(ILogger logger) { this.logger = logger; } public void SaveCustomer() { logger.Log("Saved customer"); } }

    Read the article

  • Castle Windsor upgrade causes TypeLoadException for generic types

    - by Neil Barnwell
    I have the following mapping in my Castle Windsor xml file which has worked okay (unchanged) for some time: <component id="defaultBasicRepository" service="MyApp.Models.Repositories.IBasicRepository`1, MyApp.Models" type="MyApp.Models.Repositories.Linq.BasicRepository`1, MyApp.Models" lifestyle="perWebRequest"/> I got this from the Windsor documentation at http://www.castleproject.org/container/documentation/v1rc3/usersguide/genericssupport.html. Since I upgraded Windsor, I now get the following exception at runtime: 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.TypeLoadException: GenericArguments[0], 'T', on 'MyApp.Models.Repositories.Linq.BasicRepository`1[TEntity]' violates the constraint of type parameter 'TEntity'. Source Error: Line 44: public static void ConfigureIoC() Line 45: { Line 46: var windsor = new WindsorContainer("Windsor.xml"); Line 47: Line 48: ServiceLocator.SetLocatorProvider(() = new WindsorServiceLocator(windsor)); I'm using ASP.NET MVC 1.0, Visual Studio 2008 and Castle Windsor as downloaded from http://sourceforge.net/projects/castleproject/files/InversionOfControl/2.1/Castle-Windsor-2.1.1.zip/download Can anyone shed any light on this? I'm sure the upgrade of Castle Windsor is what caused it - it's been working well for ages.

    Read the article

  • Can Castle.Windsor do automatic resolution of concrete types

    - by Anthony
    We are evaluating IoC containers for C# projects, and both Unity and Castle.Windsor are standing out. One thing that I like about Unity (NInject and StructureMap also do this) is that types where it is obvious how to construct them do not have to be registered with the IoC Container. Is there way to do this in Castle.Windsor? Am I being fair to Castle.Windsor to say that it does not do this? Is there a design reason to deliberately not do this, or is it an oversight, or just not seen as important or useful? I am aware of container.Register(AllTypes... in Windsor but that's not quite the same thing. It's not entirely automatic, and it's very broad. To illustrate the point, here are two NUnit tests doing the same thing via Unity and Castle.Windsor. The Castle.Windsor one fails. : namespace SimpleIocDemo { using NUnit.Framework; using Castle.Windsor; using Microsoft.Practices.Unity; public interface ISomeService { string DoSomething(); } public class ServiceImplementation : ISomeService { public string DoSomething() { return "Hello"; } } public class RootObject { public ISomeService SomeService { get; private set; } public RootObject(ISomeService service) { SomeService = service; } } [TestFixture] public class IocTests { [Test] public void UnityResolveTest() { UnityContainer container = new UnityContainer(); container.RegisterType<ISomeService, ServiceImplementation>(); // Root object needs no registration in Unity RootObject rootObject = container.Resolve<RootObject>(); Assert.AreEqual("Hello", rootObject.SomeService.DoSomething()); } [Test] public void WindsorResolveTest() { WindsorContainer container = new WindsorContainer(); container.AddComponent<ISomeService, ServiceImplementation>(); // fails with exception "Castle.MicroKernel.ComponentNotFoundException: // No component for supporting the service SimpleIocDemo.RootObject was found" // I could add // container.AddComponent<RootObject>(); // but that approach does not scale RootObject rootObject = container.Resolve<RootObject>(); Assert.AreEqual("Hello", rootObject.SomeService.DoSomething()); } } }

    Read the article

  • Using Castle Windsor with FluentValidation In MVC

    - by user332022
    I'm working on getting FluentValidation working with Castle Windsor. I already have a wrapper around Castle Windsor. Here is the code for that: public class ResolveType { private static IWindsorContainer _windsorContainer; public static void Initialize( IWindsorContainer windsorContainer ) { _windsorContainer = windsorContainer; } public static T Of() { return _windsorContainer.Resolve(); } } I am trying to build the FluentValidation factory as is explained at http://www.jeremyskinner.co.uk/2010/02/22/using-fluentvalidation-with-an-ioc-container The article uses StructureMap, but I thought I could adapt it to Castle Windsor like this: public class CastleWindsorValidatorFactory : ValidatorFactoryBase { public override IValidator CreateInstance( Type validatorType) { return ResolveType.Of(); } } Notice, I'm just trying to call into my wrapper so that Windsor can resolve the type reference. The problem is that this doesn't compile. I get 'The type or namespace name 'validatorType' could not be found (are you missing a using directive or an assembly reference?)' How can I make this work?

    Read the article

  • Castle Windsor, Fluent Nhibernate, and Automapping Isession closed problem

    - by SImon
    I'm new to the whole castle Windsor, Nhibernate, Fluent and Automapping stack so excuse my ignorance here. I didn't want to post another question on this as it seems there are already a huge number of questions that try to get a solution the Windsor nhib Isession management problem, but none of them have solved my problem so far. I am still getting a ISession is closed exception when I'm trying to call to the Db from my Repositories,Here is my container setup code. container.AddFacility<FactorySupportFacility>() .Register( Component.For<ISessionFactory>() .LifeStyle.Singleton .UsingFactoryMethod(() => Fluently.Configure() .Database( MsSqlConfiguration.MsSql2005. ConnectionString( c => c.Database("DbSchema").Server("Server").Username("UserName").Password("password"))) .Mappings ( m => m.AutoMappings.Add ( AutoMap.AssemblyOf<Message>(cfg) .Override<Client>(map => { map.HasManyToMany(x => x.SICCodes).Table("SICRefDataToClient"); }) .IgnoreBase<BaseEntity>() .Conventions.Add(DefaultCascade.SaveUpdate()) .Conventions.Add(new StringColumnLengthConvention(),new EnumConvention()) .Conventions.Add(new EnumConvention()) .Conventions.Add(DefaultLazy.Never()) ) ) .ExposeConfiguration(ConfigureValidator) .ExposeConfiguration(BuildDatabase) .BuildSessionFactory() as SessionFactoryImpl), Component.For<ISession>().LifeStyle.PerWebRequest.UsingFactoryMethod(kernel => kernel.Resolve<ISessionFactory>().OpenSession() )); In my repositories i inject private readonly ISession session; and use it as followes public User GetUser(int id) { User u; u = session.Get<User>(id); if (u != null && u.Id > 0) { NHibernateUtil.Initialize(u.UserDocuments); } return u; in my web.config inside <httpModules>. i have also added this line <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor"/> I'm i still missing part of the puzzle here, i can't believe that this is such a complex thing to configure for a basic need of any web application development with nHibernate and castle Windsor. I have been trying to follow the code here windsor-nhibernate-isession-mvc and i posted my question there as they seemed to have the exact same issue but mine is not resolved.

    Read the article

  • Castle Windsor and its own configuration file

    - by Coppermill
    I am using Castle Windsor for IoC, and have the configuration held in the web.config/app.config, using the following factory: public static TYPE Factory(string component) { var windsorContainer = new WindsorContainer(new XmlInterpreter()); var service = windsorContainer.Resolve<TYPE>(component); if (service == null) throw new ArgumentNullException(string.Format("Unable to find container {0}", component)); return service; } and my web.config looking like this: <configuration> <configSections> <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/> </configSections> <castle> <components> <component id="Data" service="Data.IData, Data" type="Data.DataService, Data"/> </components> </castle> <appSettings>....... Which works fine, but I'd like to place the configuration for Castle Windsor in a file called castle.config. How do I do this?

    Read the article

  • Inject App Settings using Windsor

    - by Damian Powell
    How can I inject the value of an appSettings entry (from app.config or web.config) into a service using the Windsor container? If I wanted to inject the value of a Windsor property into a service, I would do something like this: <properties> <importantIntegerProperty>666</importantIntegerProperty> </properties> <component id="myComponent" service="MyApp.IService, MyApp" type="MyApp.Service, MyApp" > <parameters> <importantInteger>#{importantIntegerProperty}</importantInteger> </parameters> </component> However, what I'd really like to do is take the value represented by #{importantIntegerProperty} from an app settings variable which might be defined like this: <appSettings> <add key="importantInteger" value="666"/> </appSettings> EDIT: To clarify; I realise that this is not natively possible with Windsor and the David Hayden article that sliderhouserules refers to is actually about his own (David Hayden's) IoC container, not Windsor. I'm surely not the first person to have this problem so what I'd like to know is how have other people solved this issue?

    Read the article

  • using MEF with NHibernate and windsor

    - by Fran
    I have an ASP.net MVC application that is using NHibernate under the covers for data access. I'm using the Windsor container to handle injecting ISession references into each controller. This works great, but now I'm looking to expand my application with a pluggable architecture so that I can have a core product and specific add-ons. I found a great article on doing this with MEF. My question is how to make the Windsor container and MEF container, life/work together so that I can achieve this. There was an article (http://codebetter.com/blogs/glenn.block/archive/2009/10/31/should-i-use-mef-with-an-ioc-container.aspx) by Glenn Block that talked about this exact issue. Then end then said that the next article would show you how to do this, but there's no part 2. Has anyone created an application like this using asp.net mvc, mef, nhibernate, castle windsor?

    Read the article

  • Castle Windsor - Resolving a generic implementation to a base type

    - by arootbeer
    I'm trying to use Windsor as a factory to provide specification implementations based on subtypes of XAbstractBase (an abstract message base class in my case). I have code like the following: public abstract class XAbstractBase { } public class YImplementation : XAbstractBase { } public class ZImplementation : XAbstractBase { } public interface ISpecification<T> where T : XAbstractBase { bool PredicateLogic(); } public class DefaultSpecificationImplementation : ISpecification<XAbstractBase> { public bool PredicateLogic() { return true; } } public class SpecificSpecificationImplementation : ISpecification<YImplementation> { public bool PredicateLogic() { /*do real work*/ } } My component registration code looks like this: container.Register( AllTypes.FromAssembly(Assembly.GetExecutingAssembly()) .BasedOn(typeof(ISpecification<>)) .WithService.FirstInterface() ) This works fine when I try to resolve ISpecification<YImplementation>; it correctly resolves SpecificSpecificationImplementation. However, when I try to resolve ISpecification<ZImplementation> Windsor throws an exception: "No component for supporting the service ISpecification'1[ZImplementation, AssemblyInfo...] was found" Does Windsor support resolving generic implementations down to base classes if no more specific implementation is registered?

    Read the article

  • Design - Where should objects be registered when using Windsor

    - by Fredrik Jansson
    I will have the following components in my application DataAccess DataAccess.Test Business Business.Test Application I was hoping to use Castle Windsor as IoC to glue the layers together but I am bit uncertain about the design of the gluing. My question is who should be responsible for registering the objects into Windsor? I have a couple of ideas; Each layer can register its own objects. To test the BL, the test bench could register mock classes for the DAL. Each layer can register the object of its dependencies, e.g. the business layer registers the components of the data access layer. To test the BL, the test bench would have to unload the "real" DAL object and register the mock objects. The application (or test app) registers all objects of the dependencies. Can someone help me with some ideas and pros/cons with the different paths? Links to example projects utilizing Castle Windsor in this way would be very helpful.

    Read the article

  • Castle Windsor XML configuration for WCF proxy using WCF Integration Facility

    - by andreyg
    Hi everybody! Currently, we use programming registration of WCF proxies in Windsor container using WCF Integration Facility. For example: container.Register( Component.For<CalculatorSoap>() .Named("calculatorSoap") .LifeStyle.Transient .ActAs(new DefaultClientModel { Endpoint = WcfEndpoint.FromConfiguration("CalculatorSoap").LogMessages() } ) ); Is there any way to do the same via Windsor XML configuration file. I can't find any sample of this on google. Thanks in advance

    Read the article

  • Can Windsor do this?

    - by Marius
    Consider this example: public class Factory { private List<ISubFactory> subFactories; public Factory(List<ISubFactory> subFactories) { this.subFactories = subFactories; } } public interface ISubFactory { } I want Windsor to resolve the Factory class and put all implementers of the ISubFactory interface which are registered in the container (ResolveAll) into the "subFactories" parameter, can Windsor do this?

    Read the article

  • Castel Windsor XML configuration for WCF proxy using WCF Integration Facility

    - by andreyg
    Hi everybody! Currently, we use programming registration of WCF proxies in Windsor container using WCF Integration Facility. For example: container.Register( Component.For<CalculatorSoap>() .Named("calculatorSoap") .LifeStyle.Transient .ActAs(new DefaultClientModel { Endpoint = WcfEndpoint.FromConfiguration("CalculatorSoap").LogMessages() } ) ); Is there any way to do the same via Windsor XML configuration file. I can't find any sample of this on google. Thanks in advance

    Read the article

  • Using FluentValidation with Castle Windsor and Entity Framework 4.0 (POCO) in MVC2

    - by Brian McCord
    This isn't a very simple question, but hopefully someone has run across it. I am trying to get the following things working together: MVC2 FluentValidation Entity Framework 4.0 (POCO) Castle Windsor I've pretty much gotten everything working. I have Castle Windsor implemented and working with the Controllers being served up by the WindsorControllerFactory that is part of MVCContrib. I also have Castle serving up the FluentValidation validators as is described by this article: http://www.jeremyskinner.co.uk/2010/02/22/using-fluentvalidation-with-an-ioc-container/ My problem comes in when I try to use Html.EditorForModel or EditorFor on a view. When I try to do that I get this error message: No component for supporting the service FluentValidation.IValidator`1[[System.Data.Entity.DynamicProxies.State_71C51A42554BA6C3CF05105DA05435AD209602C217FC4C34CA52ACEA2B06B99B, EntityFrameworkDynamicProxies-BrindleyInsurance.BusinessObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] was found This is due to using the POCO generation on Entity Framework 4.0. At runtime, the generated classes get wrapped with a Dynamic Proxy so tracking and lazy loading can happen. Apparently, when using EditorForModel or EditorFor, it tries to ask Windsor to create a validator for the dynamic proxy type instead of the underlying real type. Does anyone know what I can do to solve this issue?

    Read the article

  • How to register assemblies using Windsor in ASP.NET MVC

    - by oz
    This is how my project looks: TestMvc (my web project) has a reference to the DomainModel.Core assembly where my interfaces and business objects reside. The class that implements the interfaces in DomainModel.Core is in a different assembly called DomainModel.SqlRepository; the reason behind it is that if I just want to create a repository for Oracle I just have to deploy the new dll, change the web.config and be done with it. When I build the solution, if I look at the \bin folder of my TestMvc project, there is no reference to the DomainModel.SqlRepository, which makes sense because it's not being reference anywhere. Problem arises when my windsor controller factory tries to resolve that assembly, since it's not on the \bin directory. So is there a way to point windsor to a specific location, without adding a reference to that assembly? My web.config looks like this: <component id="UserService" service="TestMvc.DomainModel.Core.Interface, TestMvc.DomainModel.Core" type="TestMvc.DomainModel.SqlRepository.Class, TestMvc.DomainModel.SqlRepository" lifestyle="PerWebRequest" /> There's many ways around this, like copying the dll as part of the build, add the reference to the project so it will get copied to the \bin folder or install it on the GAC and add an assembly reference in the web.config. I guess my question is specific to Windsor, to see if I can give the location of my assembly and it will resolve it.

    Read the article

  • ASP.NET MVC Using Castle Windsor IoC

    - by Mad Halfling
    I have an app, modelled on the one from Apress Pro ASP.NET MVC that uses castle windsor's IoC to instantiate the controllers with their respective repositories, and this is working fine e.g. public class ItemController : Controller { private IItemsRepository itemsRepository; public ItemController(IItemsRepository windsorItemsRepository) { this.itemsRepository = windsorItemsRepository; } with using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Castle.Windsor; using Castle.Windsor.Configuration.Interpreters; using Castle.Core.Resource; using System.Reflection; using Castle.Core; namespace WebUI { public class WindsorControllerFactory : DefaultControllerFactory { WindsorContainer container; // The constructor: // 1. Sets up a new IoC container // 2. Registers all components specified in web.config // 3. Registers all controller types as components public WindsorControllerFactory() { // Instantiate a container, taking configuration from web.config container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); // Also register all the controller types as transient var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); } // Constructs the controller instance needed to service each request protected override IController GetControllerInstance(Type controllerType) { return (IController)container.Resolve(controllerType); } } } controlling the controller creation. I sometimes need to create other repository instances within controllers, to pick up data from other places, can I do this using the CW IoC, if so then how? I have been playing around with the creation of new controller classes, as they should auto-register with my existing code (if I can get this working, I can register them properly later) but when I try to instantiate them there is an obvious objection as I can't supply a repos class for the constructor (I was pretty sure that was the wrong way to go about it anyway). Any help (especially examples) would be much appreciated. Cheers MH

    Read the article

  • Use component id in Castle Windsor generic object configuration

    - by ChoccyButton
    2 questions in one, but very much related. Is it possible with Castle Windsor to resolve a configuration entry such as - Assembly.Namespace.Object1`2[[${ComponentId1}],[${ComponentId2}]], Assembly Where ComponentId1 and ComponentId2 are defined as components. Castle Windsor doesn't seem to be resolving the ComponentId, it is just looking for ComponentId1 in the Castle.Windsor assembly. The second question comes in to play if you can't do the first question. If you have to use a full assembly reference instead of a ComponentId, how can you pass any parameters to the object being created? eg to set ComponentId1.Field1 = "blah", or pass something to the constructor of ComponentId1 Hope that makes sense Update - Following the request for code I've knocked together the following - Objects public class Wrapper<T, T1> where T : ICollector where T1:IProcessor { private T _collector; private T1 _processor; public Wrapper(T collector, T1 processor) { _collector = collector; _processor = processor; } public void GetData() { _collector.CollectData(); _processor.ProcessData(); } } public class Collector1 : ICollector { public void CollectData() { Console.WriteLine("Collecting data from Collector1 ..."); } } public class Processor1 : IProcessor { public void ProcessData() { Console.WriteLine("Processing data from Processor1 ..."); } } repeated so 3 of each type of object in the example Config <components> <component id="Collector1" service="CastleWindsorPlay.ICollector, CastleWindsorPlay" type="CastleWindsorPlay.Collector1, CastleWindsorPlay"/> <component id="Collector2" service="CastleWindsorPlay.ICollector, CastleWindsorPlay" type="CastleWindsorPlay.Collector2, CastleWindsorPlay"/> <component id="Collector3" service="CastleWindsorPlay.ICollector, CastleWindsorPlay" type="CastleWindsorPlay.Collector3, CastleWindsorPlay"/> <component id="Processor1" service="CastleWindsorPlay.IProcessor, CastleWindsorPlay" type="CastleWindsorPlay.Processor1, CastleWindsorPlay"/> <component id="Processor2" service="CastleWindsorPlay.IProcessor, CastleWindsorPlay" type="CastleWindsorPlay.Processor2, CastleWindsorPlay"/> <component id="Processor3" service="CastleWindsorPlay.IProcessor, CastleWindsorPlay" type="CastleWindsorPlay.Processor3, CastleWindsorPlay"/> <component id="Wrapper1" type="CastleWindsorPlay.Wrapper`2[[CastleWindsorPlay.Collector1, CastleWindsorPlay],[CastleWindsorPlay.Processor3, CastleWindsorPlay]], CastleWindsorPlay" /> </components> Instantiation var wrapper = (Wrapper<ICollector, IProcessor>) container.Resolve("Wrapper1"); wrapper.GetData(); This brief example errors with this error message though - Can't create component 'Wrapper1' as it has dependencies to be satisfied. Wrapper1 is waiting for the following dependencies: Services: - CastleWindsorPlay.Collector1 which was not registered. - CastleWindsorPlay.Processor3 which was not registered. The curious part about this is that I can get it to resolve Collector1 and Processor3 individually before the call to the wrapper, but the wrapper still can't see them. This is a basic example, the next thing I'd like to be able to do is when instantiating the Wrapper, set a property on the collector and/or processor. So it could be something like Collector.Id = 10, but set in the config where the wrapper is defined. Setting against the Collector component definition wouldn't work as I'd want to be able to instantiate multiple copies of each Collector, using different Id's Update 2 What I'm actually trying to do is have - <components> <component id="Wrapper1" type="CastleWindsorPlay.Wrapper`2[${Collector1}(id=1)],[${Processor3}]], CastleWindsorPlay" /> <component id="Wrapper2" type="CastleWindsorPlay.Wrapper`2[${Collector1}(id=3)],[${Processor3}]], CastleWindsorPlay" /> </components> Then have another object defined as <component id="Manager" type="CastleWindsorPlay.Manager,CastleWindsorPlay"> <parameters> <wrappers> <array> <item>${Wrapper1}</item> <item>${Wrapper2}</item> </array> </wrappers> </parameters> Then finally in code just be able to call - var manager = (Manager)container.Resolve("Manager"); This should return the manager object, with an array of wrappers populated and the wrappers configured with the correct Collector and Convertor. I know there are errors in the Castle config here, that's why I'm asking the question, I don't know how to set the config up to do what I'm after, or even if it's possible to do it in Castle Windsor

    Read the article

  • 2011 PASS Board Applicants: Rob Farley

    - by andyleonard
    Introduction I am interviewing 2011 PASS Board Nominee Applicants. As listed on the PASS Board Elections site the applicants are: Rob Farley Geoff Hiten Adam Jorgensen Denise McInerney Sri Sridharan Kendal Van Dyke I'm asking everyone the same questions and blogging the responses in the order received. Rob Farley is first up: Interview With Rob Farley 1. What's your day job? I run LobsterPot Solutions out of Adelaide, Australia. We're a SQL & BI consultancy, and were the first Microsoft Partner...(read more)

    Read the article

  • Linq to SQL DataContext Windsor IoC memory leak problem

    - by Mr. Flibble
    I have an ASP.NET MVC app that creates a Linq2SQL datacontext on a per-web-request basis using Castler Windsor IoC. For some reason that I do not fully understand, every time a new datacontext is created (on every web request) about 8k of memory is taken up and not released - which inevitably causes an OutOfMemory exception. If I force garbage collection the memory is released OK. My datacontext class is very simple: public class DataContextAccessor : IDataContextAccessor { private readonly DataContext dataContext; public DataContextAccessor(string connectionString) { dataContext = new DataContext(connectionString); } public DataContext DataContext { get { return dataContext; } } } The Windsor IoC webconfig to instantiate this looks like so: <component id="DataContextAccessor" service="DomainModel.Repositories.IDataContextAccessor, DomainModel" type="DomainModel.Repositories.DataContextAccessor, DomainModel" lifestyle="PerWebRequest"> <parameters> <connectionString> ... </connectionString> </parameters> </component> Does anyone know what the problem is, and how to fix it?

    Read the article

  • How to import a resource when using Castle Windsor

    - by Gilbert
    Hi, When using spring.net, i can use <springDestinations> <objects xmlns="http://www.springframework.net"> <import resource="file://~/Config/blablabla.xml"/> </objects> </springDestinations> Using Castle Windsor, i have the following components <components> <component id="Retriever" service="Model.Services.Remote.IRetriever, Model" type="Model.Services.Remote.Retriever, Model"> <parameters> <resourceUrl>http://localhost:8888/Service.svc/</resourceUrl> </parameters> </component> </components> I'd like to to hold my components in a separate xml file for production, development etc etc. Can this be done with Castle Windsor? Thanks :-)

    Read the article

  • Passing an instantiated class to concrete class derived by Castle Windsor

    - by Tr1stan
    I have a system that I'm using to test some new architecture. I have the following setup (In MVC2 .Net - C Sharp): View < Controller < Service < Repository < DB I'm using Castle Windsor as my DI (IoC) controller, and this is working just fine in both the Service and Repo layers. However, I'm now at a point where I would like to pass an Entity Framework (DatabaseNameEntity) to the constructor to the Service, and then to the Repo, so that I have something similar to a Unit of Work pattern per request (This feels like what I'm trying to achieve anyway) - and I'm having trouble working out how this can be done using Castle Windsor. Am I going off on a silly tangent? Any pointers appreciated.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >