You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.
//Dapper + Loggingservices.AddDbConnectionFactory(
prv =>newSqlConnection(Configuration.GetConnectionString("Database")),
options =>options.WithLogLevel(LogLevel.Debug).WithSensitiveDataLogging()//to show values of the query parameters.WithConnectionProjector(c =>new{c.DataSource,c.Database}),ServiceLifetime.Scoped);
This gives an Exception:
//Include extra context into log messagesservices.AddDbConnectionFactoryWithCtx<LoggingContext>(
prv =>newSqlConnection(Configuration.GetConnectionString("Database")),
options =>options.WithLogLevel(LogLevel.Debug).WithSensitiveDataLogging()//show values of the query parameters.WithConnectionProjector(c =>new{c.DataSource,c.Database}),ServiceLifetime.Scoped);
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: EcommerceWebAPI.Services.Interfaces.IItemService Lifetime: Scoped ImplementationType: EcommerceWebAPI.Services.ItemService': Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.) (Error while validating the service descriptor 'ServiceType: DataAccessLayer.DapperFunctions Lifetime: Scoped ImplementationType: DataAccessLayer.DapperFunctions': Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.)
---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: EcommerceWebAPI.Services.Interfaces.IItemService Lifetime: Scoped ImplementationType: EcommerceWebAPI.Services.ItemService': Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.
---> System.InvalidOperationException: Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This works:
This gives an Exception:
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: EcommerceWebAPI.Services.Interfaces.IItemService Lifetime: Scoped ImplementationType: EcommerceWebAPI.Services.ItemService': Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.) (Error while validating the service descriptor 'ServiceType: DataAccessLayer.DapperFunctions Lifetime: Scoped ImplementationType: DataAccessLayer.DapperFunctions': Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.)
---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: EcommerceWebAPI.Services.Interfaces.IItemService Lifetime: Scoped ImplementationType: EcommerceWebAPI.Services.ItemService': Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.
---> System.InvalidOperationException: Unable to resolve service for type 'Dapper.Logging.IDbConnectionFactory' while attempting to activate 'DataAccessLayer.DapperFunctions'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
The text was updated successfully, but these errors were encountered: