EntityFramework-Reverse-POCO-Code-First-Generator icon indicating copy to clipboard operation
EntityFramework-Reverse-POCO-Code-First-Generator copied to clipboard

Support SQLite database

Open sjh37 opened this issue 5 years ago • 4 comments

sjh37 avatar Jan 02 '20 09:01 sjh37

Hi Simon

How is the support for sqlite going? Is this an option now or in the future?

statler avatar Mar 31 '21 04:03 statler

You should be able to use Sqlite now, even though its not yet officially supported. See case #505 about removing .HasColumnType.

sjh37 avatar Mar 31 '21 11:03 sjh37

Thanks for that Simon

Is this the only necessary adjustment? How about mappings on decimals - does this need any special treatment?

https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations

statler avatar Apr 29 '21 00:04 statler

@statler Thanks for that link.

Note to self, SQLite does not support the following types:

  • DateTimeOffset
  • Decimal
  • TimeSpan
  • UInt64

Instead of DateTimeOffset, Microsoft recommend using DateTime values. When handling multiple time zones, convert the values to UTC before saving and then converting back to the appropriate time zone.

The Decimal type provides a high level of precision. If you don't need that level of precision, however, use a double instead. You can use a value converter to continue using decimal in your classes.

modelBuilder.Entity<MyEntity>()
    .Property(e => e.DecimalProperty)
    .HasConversion<double>();

sjh37 avatar Apr 29 '21 08:04 sjh37

Simon

Just revisiting this again - 2 years on - official support? Your 'note to self' above - is that included in the templating?

Also, do you have a step-by-step for using it with Sqlite - what are the appropriate settings?

statler avatar Mar 14 '23 04:03 statler

Apologies @statler this fell off my radar. I'll get it added asap (today?) as I've popped it to the top of my list.

sjh37 avatar Mar 14 '23 09:03 sjh37

It's taking longer than expected... I'll keep it as current and get it resolved as soon as I can.

sjh37 avatar Mar 14 '23 17:03 sjh37

Thanks for your updates here Simon. When do you think you will be ready for it to be used? I will be able to provide real life feedback on a pretty complex db if that will help

statler avatar Mar 20 '23 02:03 statler

Thanks, @statler. Perhaps 2 weeks? Still got to finalise the SQL to reverse engineer the Db fully. I also need to convert one of my horrible SQL Server (if you can reverse engineer this you can reverse engineer any database) into SQLite and test with that.

sjh37 avatar Mar 20 '23 08:03 sjh37

OK thanks. Any advance on that in whatever state would be appreciated. It's pretty time sensitive for me atm.

statler avatar Mar 20 '23 09:03 statler

Hi @statler Can you give this EF.Reverse.POCO.v3.ttinclude a try in your project. Let me know how it goes.

sjh37 avatar Apr 11 '23 10:04 sjh37

This has been released in v3.8.2. Any problems, please let me know.

sjh37 avatar May 08 '23 16:05 sjh37