castle-windsor

Castle Windsor: How do you add a call to a factory facility not in xml?

只愿长相守 提交于 2019-12-06 14:18:23
问题 I know how to tell Castle Windsor to resolve a reference from a factory's method using XML, but can I do it programmatically via the Container.AddComponent() interface? If not is there any other way to do it from code? EDIT: There seems to be some confusion so let me clarify, I am looking for a way to do the following in code: <facilities> <facility id="factory.support" type="Castle.Facilities.FactorySupport.FactorySupportFacility, Castle.MicroKernel" /> </facilities> <components> <component

Can I use WcfFacility with WCF Test Client?

折月煮酒 提交于 2019-12-06 13:41:54
问题 I have a WCF Service Library containing a custom ServiceHostFactory derived from DefaultServiceHostFactory. I can't get the test client to use this factory. I just get the "no parameterless constructor was found" error. Here's my hosting enviroment configuration: <serviceHostingEnvironment> <serviceActivations> <add service="TestService.WcfLibrary.TestService" relativeAddress="/TestService.svc" factory="TestService.WcfLibrary.TestServiceHostFactory, TestService.WcfLibrary, Version=1.0.0.0,

Castle Windsor - how to resolve by name?

南笙酒味 提交于 2019-12-06 12:01:03
My application uses the "SignalR" client/server comms framework. If you aren't familiar with it, the server-side app typically contains one or more "hub" classes (similar to asmx web services), each providing methods that can be called by a client. During startup, the client needs to first create a connection, then create a "proxy" for each hub that it will need to talk to, e.g.:- var hubConnection = new HubConnection("http://..."); var fooHubProxy = hubConnection.CreateHubProxy("FooHub"); var barHubProxy = hubConnection.CreateHubProxy("BarHub"); ...etc... The string parameter passed to

Using Client-Side Task-Based Operations with WCFFacility in Castle.Windsor

偶尔善良 提交于 2019-12-06 11:04:34
I would like to take advantage of the new task-based operations for a WCF client. I am currently using the WCFFacility as follows: container.Register(Component .For<IAdminService>() .LifeStyle.Transient .AsWcfClient(new DefaultClientModel() { Endpoint = WCFHelpers.BasicHttp(settings.MaxReceivedMessageSize) .At(addr) })); where IAdminService is the ServiceContract class. All the MSDN articles about task-based operations refer to setting a 'task based operations' tick box when importing the service reference. But in the style I am currently using, there is no imported service reference because I

How to use .net core dependency injection in multiprojects solution?

痴心易碎 提交于 2019-12-06 10:45:13
I'm new to asp.net core. What I'm trying to do is to build multi projects solution and use dependency injection to pass interfaces between projects. What I know is that in ASP.NET core project we have ConfigureServices method in startup.cs file to register our interfaces and their implementations like this: public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.AddTransient<IMyInterface,MyImplementation>(); ..... } This is good if you have classes all in the same project, but what if I have multi projects ? Usually what I'll do is

Castle: How can i get the correct ILogger in the logging interceptor?

落花浮王杯 提交于 2019-12-06 08:48:11
If you are using the LoggingFacility in Castle Windsor the container will automatically resolve the logger associated with your class if you have optional logger dependencies in your class (an ILogger property that castle can inject the logger into), but how can I leverage the facility if I want to implement the logging using AOP (interceptor approach)? I basically want to write something like: public void Intercept(IInvocation invocation) { ILogger logger = LogManager.GetLogger(invocation.TargetType); //.. } But there is no LogManager to speak of in the Castle framework. What is the best

Register all classes from base on up in Castle Windsor using Fluent interface

天涯浪子 提交于 2019-12-06 08:44:18
I have an abstract base class Search . An abstract class IndexedRepositorySearch descends from Search . An abstract class FacetSearch descends from IndexedRepositorySearch . Concrete classes IngredientFacetSearch and RecipeFacetSearch descend from FacetSearch . Currently we're registering everything that descends from Search with Castle Windsor as follows: AllTypes.FromAssembly(assembly) .BasedOn<Search.Search>() .WithServiceBase() .WithServiceSelf() .LifestyleTransient() .AllowMultipleMatches() When we then call _container.ResolveAll<FacetSearch>(new { searchInput = input, searchResults });

Generic repository lifetime configuration with Windsor

谁都会走 提交于 2019-12-06 08:25:09
I'm out of ideas how to configure right Windsor container for use with repositories in Windows app. I have generic repository implementation Repository, where T is entity type, it has a dependency IDatacontextProvider, which provides datacontext for it: public class Repository<T> : IRepository<T> where T : class { protected DataContext DataContext; public Repository(IDataContextProvider dataContextProvider) { DataContext = dataContextProvider.DataContext; } .... } And for simple things everything works ok with following configuration: container.Register( Component.For<IDataContextProvider>()

Using IOC in a remoting scenario

本秂侑毒 提交于 2019-12-06 06:00:43
问题 I'm struggling with getting IOC to work in a remoting scenario. I have my application server set up to publish Services (SingleCall) which are configured via XML. This works just like this as we all know: RemotingConfiguration.Configure(ConfigFile, true); lets say my service looks like that (pseudocode) public class TourService : ITourService { IRepository _repository; public TourService() { _repository = new SqlServerRepository(); } } But what I rather would like to have sure looks like this

MassTransit 2.6.1 Request/Response pattern - Response times out

只谈情不闲聊 提交于 2019-12-06 05:57:45
问题 I'm looking at MassTransit as a ServiceBus implementation to use in a web project. I am playing with the Request/Response pattern and am seeing a long delay between the consumer receiving the message and responding, and the request publisher handling the response; sometimes, it seems like the response is never going to come through (having left it running for 10 minutes, the response has still not come through). the only times that I have seen the handle delegate get called with the response