Questions tagged [scrutor]
Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection
27
questions
0
votes
0
answers
43
views
Assembly scanning with attribute and named service in .NET Core
I've been asked to create a .NET Core implementation of CQRS pattern with the peculiarity that the request and response need to be generic because are generated client side.
Limiting the example to ...
1
vote
1
answer
59
views
Scrutor dependency injection with base class <T>
I am trying to configure scrutor so that I can pass in an IRepository<T> which then will resolve to a concreate UserRepository that inherits BaseRepository<T> : IRepositroy<T>
This ...
0
votes
4
answers
72
views
Resolve and Register services using Scrutor in Asp.net core
i have an interface(IDomainService) and a (lot) like it in my app which i mark more interfaces with it(IProductionLineTitleDuplicationChecker ) like what u will see in the rest:
public interface ...
0
votes
0
answers
20
views
The non-generic method 'ITypeSelector.AddTypes(params Type[])' cannot be used with type arguments
I have ASP.NET Core 3.1 Web API, Azure SQL Server as the database for an application.
I am using Scrutor (Version 4.0.0): https://github.com/khellang/Scrutor to automatically register your services ...
0
votes
0
answers
290
views
ASP.NET Core WebAPI : Unable to resolve service for type while attempting to activate
I am building an ASP.NET Core WebAPI application, it is working perfectly fine with the below setup
public void ConfigureServices(IServiceCollection services)
{
var settings = ...
0
votes
1
answer
162
views
How to decorate objects created by a custom factory using .NET Core DI?
Given I have a factory class responsible for constructing instances of a certain service that has constructor parameters that can only be resolved at runtime, is there a way to leverage container-...
1
vote
0
answers
245
views
Exception has occurred: CLR/System.AggregateException An unhandled exception of type 'System.AggregateException' occurred in Microsoft.Extensions.D
Hi im working of a text book called: Microservices in dotnet book second edition, and have reached a part in chapter where the author talks about Dependency Injection (DI) using a package called ...
0
votes
1
answer
195
views
Scrutor doesn't scan files from different sub projects
I have the following structure for my project:
firstProj
|
+--- src
| |
| +--- Repositories
| |
| +--- MyFirstRepository.cs
| +--- IMyFirstRepository.cs
|
secondProj
|
+--...
1
vote
1
answer
175
views
Using Scrutor for Register interface assembly
I'm using Scrutor 8.1 to register all types in my assembly that implement interfaces (ASP.NET Core 6).
I have a code structure similar to the following (all type members omitted for brevity):
services....
1
vote
1
answer
355
views
Have Scrutor scan executing assembly
I found out about / added scrutor in one of my assemblies to test it out. I commented the original registrations and added a scan statement instead:
public static IServiceCollection AddTestThing(this ...
1
vote
1
answer
319
views
Register services with child interface type using Scrutor
I have the following interfaces:
public interface IValidator
{
Task<Response> Validate(object request);
}
public interface IFirstChildValidator : IValidator
public interface ...
0
votes
1
answer
188
views
Is there a way to conditionally register types as fallback with .NET dependency injection?
We currently use SimpleInjector as our DI container to implement the command-query-separation (CQS) pattern by using ICommand and IQuery<TResult> and ICommandHandler<TCommand> and ...
0
votes
1
answer
244
views
Register dependency with Scrutor
I have 3 project
1 with controllers
2 with Appservices
3 with interfaces
I wrote interface
public interface ICheckoutAppService
{
OrderDto GetOrder();
}
Then implement it in app service
public ...
1
vote
1
answer
979
views
How to automatically Configure services in ASP.NET core?
I would like to change my Startup class to scan the system for all the classes that implement an interface and then register them automatically. I'm using Scrutor just to make life easier.
Normally, ...
0
votes
1
answer
169
views
Using AddClasses more than once in Scrutor
I am trying to use Scrutor to ease DI registration in an asp.net core 3.1 application like below
services.Scan(scan => scan
.FromAssembliesOf(typeof(IDataAccess),
...
0
votes
2
answers
1k
views
Automatic dependency injecting using Scrutor
I have many services in my project, and trying to use Scrutor for automatic DI instead registering each service manually on startup.cs
BarService.cs
public class BarService : IBar
{
public ...
0
votes
1
answer
3k
views
Get name HttpClient from IHttpClientFactory injected with DI
In Blazor I have setup two HttpClients. One for my API and one for MS Graph API.
The Graph API is new, and have forced me to find a way to inject a named httpclient in to my services.
This is all the ...
0
votes
1
answer
2k
views
Register Open Generic Decorator with Scrutor
I have a standard .Net core Api and want to use a Open Generic IReposistory and decorate that with a DomainEventPublisher for pushing out events to servicsBus after persisting.
However, I have used ...
1
vote
1
answer
157
views
Implementing Scrutor but extend cache on only few methods
I am planning to implement Scrutor
public interface ICustomersRepository
{
Task<CustomerDto> GetCustomerAsync(Guid customerId);
Task<bool> SaveCustomer(CustomerDto customer);
}
...
1
vote
1
answer
932
views
Decorate BaseController with Scrutor in .netCore 3.1
I have an application in .net core 3.1 with angular front end. I want to use the decorator to the base controller in order to log CUD operations in the entire application. I am using Scrutor nuget ...
0
votes
1
answer
1k
views
Registering a closed generic class implementation with an opened generic interface
I've just realized, that you can't register a dependency injection like this:
services.AddScoped(typeof(IConcreteRepository<,>), typeof(DepartmentRepository));
DI forbids registering non-...
1
vote
1
answer
849
views
Unable to resolve service registered via assembly scanning
Configuration
I have :
A .net core MVC app project
A module project containing
A controller (MyController),
A repository interface (IMyRepository)
A repository (MyRepository which Implements ...
0
votes
0
answers
238
views
Auto resolve DI with Scrutor
I have app service ExperienceAppService that implements interface IExperienceAppService.
I try to use Scrutoк for auto registering
I have this code in Startup file
services.Scan(scan =>
...
5
votes
4
answers
6k
views
Why do I get this InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Http.RequestDelegate'?
I've just upgraded my ASP.NET Core WebApi project from .NET Core 2.2 to 3.1.
I've fixed up all of the compile-time errors, upgraded my Nuget packages, and I can now run the app.
However, When I call ...
2
votes
1
answer
1k
views
Register interface only with class that directly inherits it in Scrutor
I'm using Scrutor to register all types in my assembly that implement interfaces. However, I want to exclude types that inherit non-abstract types that implement an interface.
I have a code structure ...
3
votes
1
answer
2k
views
Filling User Id Field in Application Insights from ASP.NET Core
I would like to be able to populate the User Id field in Application Insights with my real username data. This is an internal application, so privacy concerns with a simple username field are moot.
...
3
votes
2
answers
4k
views
How to register all interface on assembly in Scrutor similar StructureMap
How to register all interface in assembly with scan extension without write all separated in ASP.NET Core 2?
in StructureMap:
Scan(_ =>
{
// Declare which assemblies to scan
_.Assembly("...