castle-windsor

Resolve a System.Web.Services.WebService instance with Castle (for AOP purposes)

风流意气都作罢 提交于 2019-12-24 15:53:32
问题 I wanted to implement logging for an existing web service with an interceptor; in the project we're using a System.Web.Services.WebService class (those associated with asmx.cs files), but all the examples I've found online use the castle's wcf facility. Is there a way to register and resolve a System.Web.Services.WebService instance with Castle? 回答1: I doubt you can proxy an asmx WebService. IIRC the model for asmx web services is similar to ASP.NET WebForms, so the same limitations apply. 来源

How to Use Dependency Injection on UserControls & Forms

喜你入骨 提交于 2019-12-24 15:53:30
问题 Running into a knowledge gap, been out of WinForms for so long, unsure if i am doing this correctly for Castle Windsor. For the last 5 years i have developing ASP.Net applications (WebForms, MVC, etc). I now have a project where a web interface is not a viable solution, yet. So we are doing it with WinForms. With Asp.Net, i would have just set up the Castle Windsor Container, CWC , static class and everything would have taken care of itself for Dependency Injections, etc. I am having some

Castle windsor instances are registered as singleton even though explicitly declare per web request

孤者浪人 提交于 2019-12-24 15:43:14
问题 I am explicitly declaring my registerations as per web request lifecycle but they are still singletons. this is a problem because my command handlers depend on an IDbConnection which is also registered per web request. here is my registration code: container.Register( Classes .FromAssemblyContaining<EcruiterCommands>() .BasedOn(typeof (ICommandHandler<>)) .WithService.AllInterfaces() .LifestylePerWebRequest()); 回答1: I found the issue, the culprit is this line: .BasedOn(typeof (ICommandHandler

Logging with Castle Windsor, the Logging Facility and log4net

烈酒焚心 提交于 2019-12-24 15:33:35
问题 My code is : log4net.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <log4net> <appender name="MyLog" type="log4net.Appender.RollingFileAppender"> <file value="logs\log-file.txt" /> <appendToFile value="true" /> <maximumFileSize value="100KB" /> <maxSizeRollBackups value="2" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%level %thread %logger - %message%newline" /> </layout> </appender> <root> <level value="ALL" /> <appender-ref ref="MyWayLog" /> <

castle windsor register all components implementing specific interface

不想你离开。 提交于 2019-12-24 14:07:45
问题 I have multiple components implementing IPollingService interface and i'd like to register them all by convention. By the way i don't see any component registered in the container and i cannot seem to resolve them. Any idea? I tried the following but i cannot resolve them: public class PollingServicesInstaller : IWindsorInstaller { public void Install( IWindsorContainer container, IConfigurationStore store ) { var registrations = Classes.FromThisAssembly() .BasedOn<IPollingService>()

Windsor Castle resolving multiple dependencies with same interface

江枫思渺然 提交于 2019-12-24 13:08:31
问题 Problem: Class constructor is as below: public class ParsingRulesProvider : IParsingRulesProvider{ public ParsingRulesProvider(List<IParsingRule> rules){} } We have two rules: public class ARule : IParsingRule{ public ARule(IASomeObject someObject){} } public class BRule : IParsingRule{ public BRule(IBSomeObject someObject){} } Questions: How to register in code: ParsingRulesProvider with rule A and B? ParsingRulesProvider with all objects implementing IParsingRule? ARule and BRule ? 回答1: AD1

PerWebRequest Lifestyle missing in Castle Windsor 3.2

喜夏-厌秋 提交于 2019-12-24 10:56:34
问题 I was using PerWebRequest Lifestyle from Castle Windsor(version 3.0.0.4001). I wanted to update it to the latest version (3.2). In the latest version the, it says does not contain a definition for 'PerWebRequest' and no extension method 'PerWebRequest' accepting a first argument of type 'Castle.MicroKernel.Registration.Lifestyle.LifestyleGroup<.... Below is how I was registering the Component, but with the latest version it throws error: container.Register(Component.For<IUserRepository>()

Ioc/DI - Why do I have to reference all layers/assemblies in application's entry point?

纵然是瞬间 提交于 2019-12-24 10:47:13
问题 (Related to this question, EF4: Why does proxy creation have to be enabled when lazy loading is enabled?). I'm new to DI, so bear with me. I understand that the container is in charge of instantiating all of my registered types but in order to do so it requires a reference to all of the DLLs in my solution and their references. If I weren't using a DI container, I wouldn't have to reference the EntityFramework library in my MVC3 app, only my business layer, which would reference my DAL/Repo

UnitOfWork per screen in a client app using Windsor Castle

若如初见. 提交于 2019-12-24 10:13:51
问题 I'm use to build my app using MVVM + DDD. So usually my layers relation are View(ViewModel presenter) ViewModel(Service service) Service(IUnitOfWork uow, IRepository1 rep1, IRepository2 rep2) Repository1(IUnitOfWork uow, EnitityFatory1 ef1) Repository2(IUnitOfWork uow, EnitityFatory2 ef2) I'm use to resolve dependency with Windsor, so all classes as per metacode above have been installed into the container usually w/ Lifestyle.Transient for all of them but UnitOfWork. In case of a web app,

Scope was not available. Did you forget to call container.BeginScope()?

我是研究僧i 提交于 2019-12-24 07:16:18
问题 Hello I want to using castle windosr in .net core and I have get bellow error in .net core: Scope was not available. Did you forget to call container.BeginScope()? my code is : public IServiceProvider ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode