如何使用SQLite在WPF工作 [英] How to work with SQLite in WPF

查看:1419
本文介绍了如何使用SQLite在WPF工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有WPF应用程序我想使用SQLite如何做这样的事?

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

(顺便说一句我明白怎么做这样的事情在Adobe AIR,但在WPF这是一个对我来说最大的问题等等on\with比较如何是取得了一定的解释是大+ ...)

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

推荐答案

您可以使用通过对象关系映射器通过ADO.NET或(更好的) - SQLite的WPF中以同样的方式,你会使用SQL Server,Oracle或任何其他数据库。一个ORM可能是一个更好的选择,因为一个好的ORM将处理类似属性改变通知你的东西(数据绑定的关键)。

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.

您正在寻找的是基本技术定义一个模式,你将加载并通过ORM保存和数据绑定你的用户界面,使用数据绑定。 (这种模式的完整版本被称为模型 - 视图 - 视图模型或MVVM但你可能要专注于创造和后来先绑定到一个域模型和解决MVVM的更复杂的方面的基础知识的初学者。)

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

有关的事物的SQLite / ADO.NET的一面,看到的 System.Data.Sqlite,如覆盖回答您的问题更早

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

有关对象 - 关系映射,看到的numerous堆栈溢出问题,特别的 http://stackoverflow.com/questions/249550/what-orm-frameworks-for-net-do-you-like-best 和的http://stackoverflow.com/questions/90565/lightweight-alternatives-to-nhibernate

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

这篇关于如何使用SQLite在WPF工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆