Giorgi / EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.44k stars 68 forks source link

Cannot use extension optionsBuilder.UseExceptionProcessor() #38

Closed petrformanek closed 2 years ago

petrformanek commented 2 years ago

Hello, I wanted to use EntityFrameworkCore.Exceptions.SqlServer package version 3.1.4 in my project but the extension method optionsBuilder.UseExceptionProcessor() cannot be used when using entity framework in more advanced way.

I'm configuring EF with UseInternalServiceProvider(IServiceProvider).

In this case the self.ReplaceService<IStateManager, SqlServerExceptionProcessorStateManager>() cannot be used, but I need to register it to service collection as scoped service like services.AddScoped<IStateManager, SqlServerExceptionProcessorStateManager>().

The problem is that there is no extension method to do it and the SqlServerExceptionProcessorStateManager is not public.

Could you either make SqlServerExceptionProcessorStateManager public or provide some extension method? For example OracleExceptionProcessorStateManager is already public.

Thank you and have a great day!

Giorgi commented 2 years ago

@petrformanek I think it makes sense to create an extension method instead of making the classes public. Do you want to send a PR for it?

petrformanek commented 2 years ago

@Giorgi I can make a PR for it.

petrformanek commented 2 years ago

PR - https://github.com/Giorgi/EntityFramework.Exceptions/pull/39

petrformanek commented 2 years ago

PR - #39

@Giorgi do you have any estimation when are you going to check and approve the PR #39?

Giorgi commented 2 years ago

@petrformanek Can you implement it for all supported databases?

petrformanek commented 2 years ago

@Giorgi, I'm sorry but my boss won't give me time to add it to all of them.

Giorgi commented 2 years ago

@petrformanek Why should I work for your boss for free?

petrformanek commented 2 years ago

@Giorgi and what is a problem with original PR? Why it was not merged?

Giorgi commented 2 years ago

It was implemented only for one database.