2,762 questions
1
vote
2
answers
109
views
Replacing IServiceProvider in ASP.NET Core minimal API
I am attempting to migrate an ASP.NET Core application from using IWebHostBuilder to WebApplicationBuilder.
I understand that you can no longer call UseStartup.
One useful thing about the old model ...
0
votes
0
answers
31
views
Decor.NET and dependency injection with Func error Can not instantiate proxy of class
I need to use Deckor.NET https://github.com/lawrence-laz/Decor.NET/tree/master to add attribute on method.
Application is created in .NET and using Dependency injection with Transient and Func.
When ...
1
vote
1
answer
48
views
ASP.NET MVC + CastleWindsor: change resolution by header or query string
I have an ASP.NET MVC app running on .NET 4.7.1 that is using Castle Windsor (5.0.0) as its DI container. Since this version of MVC uses a ServiceLocator pattern, I'm wrapping the container inside of ...
0
votes
1
answer
63
views
Is it possible in Castle Windsor to inject a named component without registering it explicitly?
(I use logging as an example here, but it could be any type.)
I have a multiple components that would like to write to the same log file. I know that I can resolve ILoggerFactory and get the same ...
1
vote
0
answers
771
views
ASP.Net Boilerplate with .NET 8 and Serilog
We tried to update to ASP.NET Boilerplate to the newest version and .NET 8. This works fine except that we are using Serilog instead of the default logger.
We tried to do the hosting with
WebHost....
1
vote
1
answer
728
views
How to implement interceptors/aspects in a dotnet Maui app?
I'm implementing a dotnet Maui app, and got to the point when I'd need some aspects to hanlde errors and certain responses.
In the past, I implemented interceptors using Castle Windsor, but how can I ...
0
votes
1
answer
347
views
Migration NServiceBus from 7.5 to 8: Dependency using WindsorContainer
We are using NServiceBus version 7.5 and Windsor Container. We load dependencies to a Windsor container. The dependencies are (for example) from loading FromAssemblyContaining. We load existing ...
0
votes
2
answers
177
views
What's the Microsoft DI equivalent of Castle.Windsor's UsingFactoryMethod
Here is an example using Castle Windsor
Component.For<MultiInstanceFactory>().UsingFactoryMethod<MultiInstanceFactory>(k => t => (IEnumerable<object>)k.ResolveAll(t));
Where ...
0
votes
1
answer
555
views
Castle Windsor C# with .net 6 - Configuration.FromAppConfig() not supported
In the .NET 4.6 project, we used castle Windsor as a Dependency resolver.
The following code resolves all the dependencies within the current project.
IWindsorContainer container = new ...
4
votes
1
answer
555
views
Windsor resolve issue - ASP.NET Core Web API .Net version 6 cannot register my .Net framework 4.8 C# Library assembly
I am trying to get my component to be resolved in my Web API project.
I am using this code snippet for registering which works fine in my UnitTest project.
Program.cs
var builder = WebApplication....
1
vote
0
answers
2k
views
CastleWindsor dependency injection in .NET 6
we try at the moment to migrate an application from a very old .NET Core 1.1 to .NET 6. In this application we are using CastleWindsor 4.1.1 as dependency injection framework. Now we are at the point ...
1
vote
0
answers
113
views
How could I test my application services in test project?
When I try to run my test case I am getiing this exception:
System.TypeLoadException
Could not load type 'Castle.Core.Pair`2' from assembly 'Castle.Core, Version=5.0.0.0, Culture=neutral, ...
2
votes
1
answer
1k
views
Is it possible to register class with private constructor to Dependency Injection
There is a class with private constructor, and the only way to get instances of that class is to call static method CreateInstance().
Is it possible to add this class to DI and how?
I am using the ...
1
vote
0
answers
75
views
Castle Windsor Captive dependency
Prerequisites:
Castle Windsor 4.1.0
Net Framework 4.7.2
A large sequence of parallel requests
Parties:
API controller
Service A as a singleton (default lifestyle for Castle Windsor)
Service B as a ...
0
votes
1
answer
619
views
What's the Microsoft DI equivalent of Castle.Windsor's DependsOn Dependency.OnValue
I have a .NET Standard 2.0 library which has DI set up in the following way,
container.Register(Component.For<IMyFactory>()
.ImplementedBy<MyFactory>()
.DependsOn(Dependency....
0
votes
1
answer
63
views
Windsor set instance of a local variable?
I read the following code for Windsor installer.
public class MessagingInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
var ...
1
vote
1
answer
2k
views
How to resolve Windsor container dependencies for a class library in ASP.NET Core Web API project?
I have a ASP.NET Core Web API, whose Program.cs looks like below,
using Castle.Windsor;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services....
0
votes
0
answers
381
views
Is there a way to use MS Dependency Injection with Castle windor
Is there a way to use MS Dependency Injection with Castle Windsor.
I am trying to use a third party library and unfortunately they only support MS Dependency Injection installation.
(https://www....
8
votes
1
answer
4k
views
Castle Windsor 5.1.1 erroring after upgrading Castle-Core from 4.4.1 to 5.0.0 - Could not load PermissionUtil from Castle.Core
I have recently used NuGet to upgrade Castle Core to 5.0.0 and Castle Windsor to 5.1.1 in my existing ASP.NET Web Project. Castle Windsor was working perfectly before the upgrade.
Now whenever I call:
...
0
votes
1
answer
23
views
Windsor - how to register against two interfaces but separate registration lines
I currently register a large number of classes using this one-line syntax:
container.Register(Classes.FromThisAssembly().BasedOn<IWidgetViewModel>().WithService.Base().LifestyleSingleton());
...
0
votes
1
answer
69
views
How to inject a collection of a service into a strategy implementing that same service?
I have a service IService and an implementation StrategyService like that:
interface IService
{
// interface declaration here
}
class StrategyService: IService
{
IService[] services;
...
2
votes
0
answers
66
views
SignalR Castle Windsor - Is it possible to have different lifestyle for the same Castle Windsor container?
I'm using Castle Windsor as IOC in a Web Application, in this Web application I'm also using SignalR. To instanciate my signalR Hub i'm using a class that implements the IHubActivator SignalR ...
1
vote
0
answers
65
views
Castle Windsor resolving more dependencies than it releases with SignalR Activator
I don't know if my analyse is correct or not. But i'm facing some memory leak with castle and SignalR. It's a well known "issue" for Transient registered components see for example (SignalR ...
0
votes
1
answer
108
views
What could make Castle Windsor Dependency Injection differ by build config? Castle.MicroKernel.ComponentRegistrationException from name collision
I support a WPF application with multiple build configurations (local, dev, stage, etc) that uses Castle Windsor for dependency injection, and click-once for deployment. I had to update the ...
0
votes
1
answer
107
views
Windsor Castle Chain Of Responsibility ending and sorting
I am writing a list of filters as a chain and each filter has the next link in its constructor so if a certain chain link can't handle the request it passes it along until it can.
public class ...
1
vote
1
answer
78
views
Resolve/register generic object by string value in Windsor
I have an interface IImportCommand<T>
public interface IImportCommand<T> where T : ImportModelBase
{
DateTime Date { get; set; }
List<T> Items { get; set; }
}
implemented ...
0
votes
1
answer
57
views
Castle Windsor Resolving Mutiple Generic Implementations of 1 Inteface
Suppose I have the following:
public interface IFileHandler<TLocation,TRow> { ... }
//loads file in some location using record format defined in RowTypeA
//e.g. RowTypeA records exist in files ...
0
votes
1
answer
209
views
NLog with Windsor Castle - how to save log to database (.NET Core 3.1)
I am dealing with the following problem - I was able to use NLog with Windsor Castle after many tries, but it only works if I log a message string to a file. Now I want to save the custom log ...
0
votes
1
answer
3k
views
Logging Mass Transit with Serilog
I have this console application project where I use EF6 with postgresql, Quartz and Mass Transit and as DI I use Castle Winsdor. The goal of the project is to check periodically a folder (or folders) ...
2
votes
0
answers
57
views
Is it possible to name "Forwards" individually and/or differently from the "For" service in Castle Windsor?
I have a service interface that uses generics. That interface has multiple implementations. Those implementations also use generics and provide multiple concrete components for the closed service ...
0
votes
1
answer
335
views
Castle Windsor with Azure Functions (v3)
I'm going around in circles with this. Is there any way to use the Castle Windsor dependency injection adapter (https://github.com/volosoft/castle-windsor-ms-adapter) with Azure Function apps?
The ...
1
vote
1
answer
73
views
Castle windsor - service override for downstream dependencies
Assume I have interfaces A, B, C, D, and E, and F.
I am trying to set up a windsor container in such a way that my application has two instances of D, lets call them D1 and D2. A is bound with ...
-1
votes
1
answer
51
views
What's the equivalent of the DictionaryAdapterFactory of Windsor in IHostBuilder?
I am moving a console application from .NET 4.6 to .NET 5.
At the same time the idea is to get rid of Castle.Windsor and start using the builtin Dependency Injection present in Microsoft.Extensions.
I ...
5
votes
2
answers
3k
views
EF Core w/ Lazy Loading: NotImplementedException: 'This is a DynamicProxy2 error: The interceptor attempted to 'Proceed' for method
My simple line of code Db.CoverageParts.Add(newPart); is blowing the following exception from EF Core 5.0.6 / Castle 4.4.1 with Lazy Loading enabled:
System.NotImplementedException
HResult=...
0
votes
1
answer
381
views
How to remove a component from castle windsor 5.0
I am new to using Castle Windsor I have a couple of registered dependencies using Castle Windsor. I would like to dispose and remove one of these injected dependency at a particular time. How can I do ...
0
votes
0
answers
440
views
How to upgrade Castle.windsor from version 4 to version 5.0.1
While upgrading Castle.Windsor to version 5, I found out that the PerWebRequest is removed from LifestyleTypes enum.
In my application I am registering the components with different lifestyles like ...
1
vote
0
answers
142
views
Using Umbraco ContentService in a Castle Windsor container in Ucommerce
I've a custom service that I've written into a Ucommerce pipeline task, but that is implementing the Umbraco ContentService. This has meant that I've also needed to inject that service into container ...
1
vote
0
answers
97
views
Castle.Services.Transaction upgrade from 2.5 to 3.0.2 issues
I am trying to upgrade Castle.Windsor lib from 2.5.3 to 5.0.1. I could figure out the deprecated properties, methods and could upgrade the Windsor to newer version but ran into runtime error. So I ...
0
votes
1
answer
387
views
Castle Windsor container.Resolve produces null reference exception
In my Visual Studio environment my project that uses Castle Windsor dependency injection runs correctly.
When deployed to a target environment however, it fails to start. Capturing exceptions has show ...
0
votes
0
answers
126
views
Why Is Castle Windsor MVC Not Working On Server?
I have added Castle Windsor MVC package to my project to facilitate DI. Is works fine on my local machine. But when I deploy to the server I get this on the page:
No parameterless constructor defined ...
2
votes
1
answer
122
views
Castle Windsor - FileNotFoundException in Unit Tests
I’ve inherited an ASP.Net web application comprising of VB.Net projects. I’ve added a C# project to the solution, which references several of the VB.Net projects.
The application uses Castle Windsor ...
0
votes
1
answer
259
views
C# Castle Windsor does not inject NLog instance when using factory
The problem is that when I'm using the LoggingFacility of Windsor.Castle (WC) the ILogger instance is still a NullLogger instance when the class is being created using a custom factory class. Creating ...
0
votes
0
answers
317
views
C# Windsor.Castle exception could not instantiate ApplicatioName.MainWindow
When I'm trying to run an application that was developed in C# with the use of Windsor.Castle as DI I get an exception at startup and a long stacktrace. The last line is as follows:
at System.Windows....
0
votes
1
answer
4k
views
How to inject dependency MassTransit Consumer in windsor container
How to use dependency injection in consumer class. I get error message as "The type 'Esb.Masstransit.RabbitMq.Application.IEventConsumerService' cannot be used as type parameter 'TConsumer' in ...
0
votes
1
answer
462
views
Replacing CastleWindsor with Autofac in .NETCore3.1
I was using CastleWindsor in my ASP.NETCore2.2 WebAPI project and was working fine. I'm migrating to ASP.NETCore3.1 now and it doesn't look like CastleWindor has offical support for that so I decided ...
0
votes
1
answer
479
views
C# Castle Windsor DI with LoggingFacility and core.logging doesn't log Exception
For a project I'm using Castle Windsor DI (new for me). The Castle.Core.Logging namespace with its interface Logger has these methods (also with Debug, Error etc):
void Fatal(string message, ...
2
votes
0
answers
62
views
Castle Windsor and same service registered from signed assemblies with multiple versions
I have an application which loads different versions of strongly signed assembly at the same time.
Classes in each assembly become scanned and installed via WindsorInstaller after assembly load.
I ...
0
votes
1
answer
139
views
Install aspent boilerplate package on new project get error
I'm using new abp version template (Aspnet MVC+AngularJs) and want to add new class library project to it, when install abp nugget package (5.10.1) to it, got this error:
unable to find a version of '...
2
votes
2
answers
5k
views
Dependency Injection in NuGet package library
This builds on concepts discussed in this question
How to manage Castle Windsor dependencies in a nuget library.
I am working on a project which uses Castle.Windsor for DI and references several ...
0
votes
0
answers
139
views
Castle windsor does not inject in base abtract class properties
I have a peculiar issue that I have run to. I have two abstract classes that inherit from each other. The one at the base of the hierarchy has some properties that I want to be injected by Castle ...