henkmollema / Dapper-FluentMap

Provides a simple API to fluently map POCO properties to database columns when using Dapper.
MIT License
429 stars 88 forks source link

How can I make the database to use the default value I set,How to map. #130

Closed babbitt9 closed 1 year ago

babbitt9 commented 3 years ago

My program use Sqlite 3 and I set a datetime field with the defalut value of datetime('now', 'localtime').

  1. When I map the field with the Ignore method, it's ok to insert a new record ,the field is filled a correct datetime value(my server time).But when I get the record(by ExecuteReader) from database ,someting is wrong (System.NotImplementedException) because the field is ignored.
  2. I try to map the field with SetGeneratedOption(DatabaseGeneratedOption.Identity) or .SetGeneratedOption(DatabaseGeneratedOption.Computed) ,the field is filled with '0001-01-01 00:00:00'

Is there a way to do that I can get the correct datetime value and I can query the record without exception? Thanks!

ddimkovikj commented 3 years ago

@babbitt9 can you share the POCO class and the corresponding map so we can reproduce this issue?

henkmollema commented 1 year ago

I'm archiving this repository as I'm not using this library myself anymore and have no time maintaining it. Thanks for using it.