Comments (6)
Yeah, it seems that was the problem.
I can handle without WithAutoConcreteTypeResolution =)
Thanks man
from dryioc.
Func<String, Microsoft.Extensions.Logging.LogLevel, Boolean>
The func returns bool
, so it should be registered.
How and what does it mean is up to you.
You may register a method returning bool
(via Made.Of) and use service key to identify it.
from dryioc.
dadhi, I believe I still need your help. I am running a asp.net core app. I tryed to follow examples around the internet but I am stuck.
Btw, I created a bare netcore 2.1 project if you have a moment to take a look.
https://github.com/jkvargas/samplemvcdryioc
I did try to minimize the code of my app, I just created a new mvc app with individual authentication using netcoreapp2.0. And I've tryed to integrate DryIoc.
`public IServiceProvider ConfigureServices(IServiceCollection services)
{
var container = new Container(rules => rules
.WithoutThrowOnRegisteringDisposableTransient()
.WithTrackingDisposableTransients()
.WithAutoConcreteTypeResolution());
container.Register<IAppConfig, AppConfig>(Reuse.Transient);
var newContainer = container.WithDependencyInjectionAdapter(services, throwIfUnresolved: type => type.Name.EndsWith("Controller"));
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
return newContainer.Resolve<IServiceProvider>();
}`
It keeps returning "DryIoc.ContainerException: 'Unable to get constructor of Boolean using provided constructor selector when resolving Boolean {ReturnDefault} #101 with args [_String0]
in wrapper Func<String, Microsoft.Extensions.Logging.LogLevel, Boolean> {ReturnDefault} as parameter "filter" #11 with args [_String0]
in singleton Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider: Microsoft.Extensions.Logging.ILoggerProvider {ServiceKey=DefaultKey(0), ReturnDefault} #51
in wrapper IEnumerable<Microsoft.Extensions.Logging.ILoggerProvider> {ReturnDefault} as parameter "providers" #1
in singleton Microsoft.Extensions.Logging.LoggerFactory: Microsoft.Extensions.Logging.ILoggerFactory as parameter "factory" #41
in singleton Microsoft.Extensions.Logging.Logger<Microsoft.AspNetCore.Hosting.Internal.WebHost>: Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Hosting.Internal.WebHost> #100
from container.'"
Isn't this a problem with the integration?
from dryioc.
Now looking at used setup and exception I have more clues, thanks.
What if you remove WithAutoConcreteTypeResolution()
?
Any reason you need it?
Looking at your example, I have an idea how to improve exception messsge when using Auto resolution.
When I have time, I will check more thoroughly.
from dryioc.
Cool, anyway need to improve some things.
AutoConcreteTypeResolution
probably should not consider Func
arguments.
from dryioc.
After some thoughts, the automatic resolution should not consider a primitive type, like int
, but using a Func<MyType>
actually is fine.
from dryioc.
Related Issues (20)
- Update the broken feature matrix link with something new HOT 1
- How to diagnose Error.WaitForScopedServiceIsCreatedTimeoutExpired? HOT 2
- Breaking changes in MefAttributedModel HOT 4
- Release 5.4.2 is Broken for Framework 4.8 HOT 4
- Allow filling of properties on an existing instance
- FastExpressionCompiler fails on iOS HOT 3
- Add direct net8.0 target as soon as Appveyor CI will support it HOT 5
- ConstructorWithResolvableArguments conflicts with dynamic registrations
- For the conditional singleton or the singleton registered with AnyKey - should we create a new singleton per condition or the resolution key? HOT 1
- Why docs not mentioned with register keyed services base on attributes?
- Possibility to resolve only Non-Keyed services in the collection wrapper
- Add possibility to obtain all service keys for the registered service
- Multiple same service key support mostly for DryIoc.MS.DI though it is already supported in DryIoc.MefAttributedModel
- Move Throw.GetMatchedException to Rules so that extensions may modify it without conflicts HOT 1
- Scoped service decorator HOT 4
- Consistent behavior of a faulty singleton HOT 2
- FactoryType is not forwarded in the RegisterMapping<TService, TRegisteredService> method HOT 1
- IDisposable dependencies does not get disposed when web request ends HOT 5
- Add the HotUsedInstance for fast access to skip all the resolution steps
- Conditional registrations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dryioc.