简体   繁体   中英

How to work with SQLite in WPF

I have WPF APP I want to use SQLite How to do such thing?

(BTW I understand how to do such thing in Adobe Air but in WPF it's a big question for me so some explanation made on\\with comparing how to's is Big +...)

You can use SQLite in WPF the same way you would use SQL Server, Oracle or any other database -- via ADO.NET or (better) via an object-relational mapper. An ORM is probably a better option because a good ORM will handle things like property change notifications (critical for data binding) for you.

The basic technique you are looking for is to define a model which you will load and save via the ORM, and databind your UI to using data binding. (The full version of this pattern is called model-view-viewmodel or MVVM but as a beginner you probably want to focus on the basics of creating and binding to a domain model first and tackle the more complex aspects of MVVM later.)

For the SQLite / ADO.NET side of things, see System.Data.Sqlite, as covered in answers to your earlier question .

For object-relational mapping, see numerous Stack Overflow questions , especially https://stackoverflow.com/questions/249550/what-orm-frameworks-for-net-do-you-like-best and Lightweight alternatives to NHibernate .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM