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

SQLTime not assigned to TimeSpan #251

Open
reibanaag opened this issue Sep 21, 2021 · 1 comment
Open

SQLTime not assigned to TimeSpan #251

reibanaag opened this issue Sep 21, 2021 · 1 comment

Comments

@reibanaag
Copy link

Hi,

Good Day!

There seemed to be an issue when retrieving time data type because it is always null when it was mapped to timespan in c#.

This is the table:

CREATE TABLE [dbo].[DeliverySchedule]
(
[Id] INT IDENTITY(1,1) PRIMARY KEY,
[ArrivalTime] TIME NOT NULL DEFAULT N'10:00:00'
);
GO

[Dapper.Table("DeliverySchedule")]
public class DeliverySchedule
{
public virtual Int32 Id { get; set; }
public virtual TimeSpan ArrivalTime { get; set; }
}

in my code

var deliveries = conn.GetListAsync().Result;

but when I check the deliveries the Id field was assigned but the ArrivalTime is still null

I hope you can help me with this.

Thank you.

@BlinkSun
Copy link

The type DateTime work perfectly from my side ... to convert to TimeSpan, look at those solutions:
https://stackoverflow.com/questions/1026841/how-to-get-only-time-from-date-time-c-sharp

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

No branches or pull requests

2 participants