jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
861 stars 145 forks source link

datetime2 transformed to the datetime when datetime2 in TVP. #385

Closed NextStalker closed 6 years ago

NextStalker commented 6 years ago

Describe the bug

Two records are not equal.

2018-10-30 10:32:53.2415414 2018-10-30 10:32:53.2400000

Steps to reproduce

create table [dbo].[TestTable]( [Id] [int] identity(1,1) not null, [MyDatetime2] [datetime2](7) not null ) on [primary]

create type [dbo].[datetime2List] as table( [myDatetime2] [datetime2](7) not null, [name] [nvarchar](50) not null)

create procedure [dbo].[InsertDateTime2] @myDatetime2 datetime2 as insert into TestTable(MyDatetime2) values(@myDatetime2)

create procedure [dbo].[InsertDateTime2List] @datetime2List as datetime2List readonly as insert into TestTable(MyDatetime2) select myDatetime2 from @datetime2List

public class DateTime2Model { public DateTime MyDatetime2 { get; set; } }

[Sql(Schema = "dbo")] public interface IDateTime2Repository { void InsertDateTime2(DateTime2Model dateTime2Test); void InsertDateTime2List(IList<DateTime2Model> dateTime2TestList); }

  var model = new DateTime2Model { MyDatetime2 = DateTime.UtcNow };
  var repo = connection.As<IDateTime2Repository>();
  repo.InsertDateTime2(model);
  var list = new List<DateTime2Model> { model };
  repo.InsertDateTime2List(list);

Expected behavior

Two records are equal.

jonwagner commented 6 years ago

This is fixed in master. Will be in the 6.2.7 release

clarity89 commented 6 years ago

Hi, @jonwagner do you have approximate date for release 6.2.7 ?

jonwagner commented 6 years ago

Just released.