离线数据库 C#
我现在开始从事一个大型软件项目,我首先需要的是一个可以保存所有数据的地方。 我将用 C# 编写该软件,并且我已经在寻找离线数据库解决方案,但我不知道什么对我来说是最好的。 我的软件应该始终访问数据,并且数据不应该位于服务器上。
那么有人有离线数据库的经验吗?
希望有人能帮助我。
I started working on a big software project at the moment and what I need first is a place, where I can save all my data.
I´ll write the software in C# and I already looked around for an offline-database solution but I don´t know, what is the best for me.
My software should access the data all time and it should not be on a server.
So does anybody have experience with offline-databases?
Hope somebody can help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
另一种可能性:MS SQL CE - 与 SQL Server Express 非常相似但基于文件,无需安装服务器......
Another possibility: MS SQL CE - Very similar to SQL Server Express but file based, no server installation needed...
您应该使用与在服务器上使用的相同的软件,只是本例中的服务器是您的本地计算机。
因此,如果您更喜欢 SQL Server,则可以下载并安装 SQL Server Express (如果它没有预先安装在您的计算机上)。
如果您更喜欢 MySQL,也可以下载并安装它。
谷歌搜索应该会引导您进入几乎所有您可能想要使用的其他数据库平台的下载页面。
You should use the same software that you would use on a server, only the server in this case is your local machine.
So, if you prefer SQL Server, then you can download and install SQL Server Express (if it wasn't pre-installed on your computer in the first place).
If you prefer MySQL, you can download and install that as well.
A Google search should lead you to the download page of nearly any other database platform that you might want to use.
好吧,我认为离线这个词有点误导——如果你的意思是某种本地关系数据库——不是托管在某个远程服务器上。您的应用程序始终可以使用它。
这里有很多解决方案,我会首先看看 SQL-Server Express 或 SQLite。两者都是成熟且经过验证的产品,已在数百万种应用中使用。 SQLite 更轻量级,但由于您不谈论性能问题,我建议您这样做,因为它不需要从您的应用程序中单独安装。 C# 有许多不同的 SQLite 包装器库。
还有其他解决方案 MySQL 和 Postgresql - 但从 C# 世界来看,我可能会在评估它们之前先看看前两个。
Ok, I think the term offline is a bit misleading - if what you mean is a local relational database of some sort - not hosted on some remote server. It is available all the time to your application.
You have an awful lot of solutions here, I would look at SQL-Server Express or SQLite first. Both are mature well proven products, used in millions of applications. SQLite is a little more lightweight, but since you don't talk about performance issues, I would recommend that as it does not need a separate installation form your app. There are a bunch of different SQLite wrapper libraries for C#.
There are other solutions MySQL and Postgresql - but from the C# world I would perhaps start looking at the first two before evaluating these.
考虑到“离线数据库”作为“本地数据库”,我推荐 Sql Express。它是一个优秀且“轻量级”的数据库,非常适合在开发机器上运行。
顺便说一句,无论您选择哪种持久性策略,都应在其上保留一个抽象层,以便您始终可以以更简单的方式改变您的想法或需求。
Considering 'offline database' as 'local database', i recommend Sql Express. It's a fine and 'lightweight' DB, ideal for running on a developing machine.
On a side note, whichever persistence strategy you choose, keep a layer of abstraction over it, so you can always change your mind or your requirements in a simpler way.
如果您使用的是 Windows 计算机,那么您的计算机上很可能已经安装了 SQL Server Express。它的功能非常齐全,但正如您所描述的那样,绝对适合离线使用。
如果您处于单声道 C# 环境中,或者您只是想要简单安装一些东西,因为您将为其他计算机编写安装程序,那么我建议使用 FireBird 嵌入式 或 SQLite。它们都是嵌入式数据库,可以将自己存储到您选择的文件中(SQLite 也可以完全在内存中执行此操作,但它会在运行之间消失)。
If you are on a windows machine, then you most likely already have SQL Server Express installed on your machine. It's very full featured, but is definitely intended for offline use as you've described.
If you are in a mono C# environment, or you just want something simple to install as you'll be writing an installer for other machines, then I would recommend using FireBird Embedded or SQLite. They are both embedded databases that store themselves into a file wherever you choose (SQLite can also do this completely in memory, but it dissappears between runs).
这是一个解释“离线数据库”的教程:这里
我几乎同样的问题,我发现了这个教程,它对我来说非常完美。
Here is a tutorial that explains 'offline-databases': here
I had almost the same problem and i found this tutorial and it woked for me just perfect.