27,065 questions
0
votes
0
answers
20
views
MediatR Nuget package versions creating problems
I am getting a version mismatch error when using MediatR in my .NET project.
What happened:
Yesterday my project worked correctly with no errors.
Today I updated some NuGet packages by mistake.
After ...
Best practices
0
votes
0
replies
22
views
How to get Autofac Instance Per Request semantics in Asp.Net Core while keeping it idiomatic, i.e. not using tagged matching scopes?
In Asp.Net (not Core) we have InstancePerRequest which uses tagged matching child scopes.
In Asp.Net Core they deprecated InstancePerRequest in favour of InstancePerLifetimeScope which as I understand ...
3
votes
1
answer
98
views
What options exist for ownership/references in Rust dependency injection?
I'm interested in the options for providing ownership or references to dependencies when doing dependency injection in Rust. I don't mean like a DI framework or anything like that, just the general ...
-1
votes
0
answers
16
views
"Repeats modules with scoped bindings or declarations" error after migrating to dagger 2.52
I'm getting the following issue when I build my package.
Repeats modules with scoped bindings or declarations
- a.b.c.component also includes:
- a.b.c.d.module with scopes: @javax.inject.Singleton
...
3
votes
2
answers
108
views
How can I tell if a Spring ApplicationContext has been refreshed without using an event listener?
I have an instance of a Spring ApplicationContext in a method and I need to "probe" it and decide if:
it has been fully refresh()ed at least once so I can be sure that the beanFactory is ...
2
votes
1
answer
70
views
AutoFac DependencyResolutionException when using hybrid cache with redis
I run into a runtime error when using autofac in combination with hybrid cache and redis. I hope someone can explain why this error occurs.
When using autofac to resolve an instance of HybridCache in ...
-3
votes
1
answer
79
views
.Net Core 9 DI for dynamic instance creation and its required services [closed]
I have the following 2 classes. MyClass composes MyOtherClasses. Each of them requires different ILogger<foo>:
public class MyClass
{
private readonly ILogger<MyClass> _logger;
...
1
vote
1
answer
54
views
AutoFac: How to select a service required by consumer with an intermediate handler class (consumer>handler>IService
I have a class Handler with interface IHandler that depends on IService, which in turn has two implementations ServiceA and ServiceB. Then I have a class Consumer which depends on Handler and knows at ...
0
votes
3
answers
141
views
Resolving a circular/recursive dependency with dependency injection
Say I have this interface:
public interface IExample
{
string GetSupportedExtension();
void DoWork(Stream input);
}
a concrete implementation like:
public class PdfExample : IExample
{
...
2
votes
1
answer
117
views
Set up Koin in modularized Android project for Compose previews
I'm setting up an Android project, where I've separated the code into different modules to have a bit of a cleaner structure. The modules are presentation, domain, data, di and app. I am including a ...
1
vote
0
answers
75
views
Resolving ServiceProvider DI Container and Prism Dialog registration
I currently have a ServiceProvider that registers certain types from the current assembly within one container. I am trying to implement a separate prism dialogservice that would register only ...
1
vote
2
answers
119
views
ASP.NET Core dependency inject (Generic) error
I want to create a repository base class, every service should inherit from this BaseService.
This is my code:
public class BaseService<TEntity, TAddDto, TUpdateDto, TEntityDto> : IBaseService&...
1
vote
1
answer
101
views
Polymorphic deserialize JSON using DI container to create instances
Consider these model classes:
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")]
[JsonDerivedType(typeof(A), typeDiscriminator: nameof(A))]
[JsonDerivedType(typeof(B), ...
0
votes
1
answer
73
views
Cannot use Connection.transaction() in a manually started transaction
The code is used in many projects and works but in one service sometimes an error occurs:
"InterfaceError: (sqlalchemy.dialects.postgresql.asyncpg.InterfaceError) <class 'asyncpg.exceptions....
0
votes
0
answers
57
views
Autofac: ObjectDisposedException when resolving dependencies from factory delegate in ASP.NET Web API
I have an ASP.NET Web API project using Autofac for dependency injection.
I register a factory for creating ICommandExecutor based on an enum:
builder.Register<Func<CommandType, ICommandExecutor&...
0
votes
1
answer
94
views
Registration of Views and ViewModels with a parametered constructor in MAUI
I have the following code in a basic .NET MAUI app.
My main page:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/...
4
votes
2
answers
130
views
How to override inject() dependency from abstract base class in Angular?
I have an abstract base class that used to accept a service via constructor injection:
export abstract class BaseEditEventClass<T> extends BaseFormClass {
constructor(protected _service: ...
1
vote
0
answers
62
views
InjectionException on application shutdown
I have a label provider for my model tree view:
public class ModelTreeLabelProvider implements ILabelProvider {
@Inject
IWorkbench workbench;
@Override
public Image getImage(Object ...
1
vote
0
answers
74
views
MongoRepository bean not found when repository is in external JAR dependency
My microservice uses an external dependency which is a JAR build by my company.
I can't figure why the bean is not found.
***************************
APPLICATION FAILED TO START
***********************...
0
votes
1
answer
100
views
Generic mongoose dynamic module cannot inject options
I wanna have a dynamic module which should take care of registering mongoose for me. Right now I have a problem with injecting the options asynchronously when I am invoking MongooseModule.forRootAsync(...
0
votes
0
answers
50
views
How to delay initialization of SQL-based configuration in ASP.NET Core startup without using BuildServiceProvider?
I am using an ASP.NET Core 9.0 Web API with C#. My application setup uses L1 Cache using FusionAPI and L2 is Garnet Server for distributed layer of cache. The following code snippet is from my Startup....
-1
votes
3
answers
103
views
What is the difference between these two methods of returning new instance value?
The first method is the normal code execution.
The second method is the one that is commented out.
Isn't returning an instance of a class from a newly created standalone service provider the same as ...
1
vote
1
answer
148
views
.Net 8 dependency injection using reflection: service with generic method returning Task<>
I want to load all types from an assembly and register them for dependency injection, using the following reflection-heavy method:
using System.Reflection;
namespace Server
{
public static class ...
1
vote
1
answer
59
views
GetRequiredKeyService Failing for Unbound Generic
I'm looking at a way to resolve dependencies using keyed services.
I have a very simple interface (for now):
public interface ITest<T>
{
T Get(string key);
}
With two very simple ...
0
votes
1
answer
210
views
SQLAlchemy, FastAPI, Dishka. Cannot use Connection.transaction() in a manually started transaction
The code is used in many projects and everything works. But in one service, sometimes an error occurs on the prod:
sqlalchemy.exc.InterfaceError: (sqlalchemy.dialects.postgresql.asyncpg.InterfaceError)...