Rella
Rella

Reputation: 66985

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 +...)

Upvotes: 5

Views: 9794

Answers (1)

itowlson
itowlson

Reputation: 74842

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.

Upvotes: 9

Related Questions