Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Bulk Merge While Using ZonedDateTime Property for Dapper Plus #66

Closed
Jaanzaib opened this issue May 17, 2021 · 2 comments
Closed
Assignees

Comments

@Jaanzaib
Copy link

Jaanzaib commented May 17, 2021

Hi,
I have a class with a NodaTime.ZonedDateTime Property like below.

public class Reservation
{
    public ZonedDateTime BookedOnDate { get; set; }
}

I am using Dapper Plus Bulk Merge to store data into postgres database like below.

    public async Task UpdateReservationsAsync(IEnumerable<Reservation> reservations)
    {
        using (var connection = _connectionFactory.GetPostgresServerConnection())
        {
            await connection.BulkActionAsync(x => x.BulkMerge(reservations));
        }
    }

before that i am adding the support for above property like below in Startup.cs file

DapperPlusManager.AddCustomSupportedType(typeof(NodaTime.ZonedDateTime));

Running the code gives me the following exception. pgsql column data type is timestamptz

System.InvalidCastException: 'Can't write CLR type NodaTime.ZonedDateTime with handler type TimestampHandler'

Please note that it works fine for Bulk Insert but gives exception for Bulk Merge.

Any help would be appreciated.

@JonathanMagnan JonathanMagnan self-assigned this May 17, 2021
@JonathanMagnan
Copy link
Member

Thank you for reporting,

We will look at it.

@JonathanMagnan
Copy link
Member

Hello @Jaanzaib ,

A new version has been released.

By developed made a few change to better support this kind of special type.

Could you try it and let us know if everything works correctly?

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants