hryz / Dapper.Logging

Integration of the DbConnection and Asp.Net Core Logging
MIT License
43 stars 15 forks source link

Configure returned Dapper.Logging.Hooks.WrappedConnection to use NodaTime #13

Open carlos0202 opened 3 years ago

carlos0202 commented 3 years ago

How can I use NpgSqlConnection.TypeMapper property to register NodaTime when getting connection using factory?

Thanks in advance for the help.

hryz commented 3 years ago

Sorry for a really late reply. Could you elaborate on the issue if it's still relevant?

hryz commented 3 years ago

Hey @carlos0202, I guess TypeMapper is the same for different queries. You can configure a created connection in a factory method provided during the initial setup:

services.AddDbConnectionFactory(
                prv => new NpgsqlConnection(conStr){TypeMapper = { /* here */}}   );