What's the best way to turn a .Net class into a SQLite table?
I have a bunch of classes in a WPF application, that read data from a REST service. I've decided to save time and traffic by saving the replies that rarely change in a SQLite database. I'm planning to use System.Data.SQLite to access the db.
开发者_如何学GoMy question is: what's the best (read: elegant, fast, nice) way to take class properties and turn it into a SQL Create statement? Yes, I can start typing and configuring, and it would take less than an hour, but Ihave a nagging feeling I am missing a trick or two here.
Any reply acceptable: Visual Studio tool, Linq, a class attribute I'm missing - I am in a learning mode/mood.
Thanks for your time and replies.
GuyWhy not use an ORM like NHibernate, and have it automatically generate your schema for you? this both handles your issue at hand, and also saves you from a bunch of left hand/right hand coding to populate your tables down the road.
You should find yourself an ORM which will do this for you.
Try Devart dotConnect for SQLite - http://www.devart.com/dotconnect/sqlite/, this product contains an enhancement of LINQ to SQL which works with SQLite databases. This solution will be very elegant and fast.
精彩评论