database 对于小型 .NET 应用程序,什么是好的数据库选择?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6749556/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 08:15:46  来源:igfitidea点击:

What is a good choice of database for a small .NET application?

mongodbsqlitevistadbeloqueradatabase

提问by ePezhman

I'm developing a small application with C# in .NET and I want to have a small light weight databasewhich does not use much resources.

我正在 .NET 中使用 C# 开发一个小型应用程序,我想要一个不使用太多资源的小型轻量级数据库

Could you please list some of the best known light weight database softwares.

您能否列出一些最著名的轻量级数据库软件

回答by Adam Houldsworth

14/06/2016Yep... still getting upvotes :-/

14/06/2016是的......仍然得到upvotes: - /



17/03/2014I'm still receiving upvotes for this, be mindful of the date this was originally answered. Though the main three items listed are still entirely viable, the list will tend towards becoming stale. There are further database technologies available that are not listed.

17/03/2014我仍然收到此upvotes,铭记这原本是回答的日期。尽管列出的主要三个项目仍然完全可行,但该列表将趋于陈旧。还有其他未列出的可用数据库技术。



You have a couple of immediately recognisable and free options:

您有几个可立即识别且免费的选项:

The SQL Server Compact download comes with the ADO.NET provider that you will need to reference in code. The SQLite download might not have it so here is a link:

SQL Server Compact 下载附带了您需要在代码中引用的 ADO.NET 提供程序。SQLite 下载可能没有它,所以这里是一个链接:

http://sqlite.phxsoftware.com/

http://sqlite.phxsoftware.com/

All three use SQL, though likely with a few limitations / quirks. Management Studio works with Compact and LocalDB, whereas with SQLite you will need another UI tool such as SQLite Administrator:

这三个都使用 SQL,尽管可能有一些限制/怪癖。Management Studio 适用于 Compact 和 LocalDB,而对于 SQLite,您将需要另一个 UI 工具,例如 SQLite Administrator:

http://sqliteadmin.orbmu2k.de/

http://sqliteadmin.orbmu2k.de/

There are NoSQL alternatives, such as:

有 NoSQL 替代方案,例如:

Personally I would avoid using MS Access in the face of other free options. You cannot go wrong with LocalDB, Compact, or SQLite. They are all lovely small databases that run relatively quickly in little RAM - personal preference as to the religious aspects about liking a Microsoft product I suppose :-)

就我个人而言,面对其他免费选项,我会避免使用 MS Access。使用 LocalDB、Compact 或 SQLite 不会出错。它们都是可爱的小型数据库,在很小的 RAM 中运行速度相对较快 - 我想是个人喜好关于喜欢 Microsoft 产品的宗教方面:-)

I use Sterling for Windows Phone programming as it is built to use Isolated Storage. I have only seen articles on RavenDb, but I can tell you that it is a JSON based document storage framework.

我使用 Sterling 进行 Windows Phone 编程,因为它是为使用独立存储而构建的。我只看过 RavenDb 的文章,但是我可以告诉你,它是一个基于 JSON 的文档存储框架。

Not to confuse the situation (go with SQLite, SQL Server Express LocalDB, or SQL Server Compact Edition), but there are other embedded / local databases out there, some are relational others are object-oriented:

不要混淆情况(使用 SQLite、SQL Server Express LocalDB 或 SQL Server Compact Edition),但是还有其他嵌入式/本地数据库,有些是关系型的,有些是面向对象的:

Not all of these are free. SQL / LINQ / in-proc support differs across them all. This list is just for curiosity.

并非所有这些都是免费的。SQL / LINQ / 进程内支持在它们之间有所不同。这个列表只是为了好奇。

There is now also Karvonite, however the code gallery link is broken. When it's live again I'll be looking into this one for WP7 development.

现在还有Karvonite,但是代码库链接已损坏。当它再次上线时,我会为 WP7 开发研究这个。

回答by Mike Webb

I'd recommend SQLite. We are using it for almost all of the apps we develop where I work.

我会推荐SQLite。我们在我工作的地方开发的几乎所有应用程序都使用它。

It's small and compact. It does require a DLL to be in the app directory, but you don't have to have other software installed like Access or SQL Server. Also, as stated by danielkza below, "SQLite is public domain, so you don't have to worry at all about licensing." That can really make a big difference.

它小巧紧凑。它确实需要一个 DLL 位于应用程序目录中,但您不必安装其他软件,如 Access 或 SQL Server。此外,正如下面的 danielkza 所说,“SQLite 是公共领域,因此您完全不必担心许可问题。” 这真的可以产生很大的不同。

You can use System.Data.SQLiteor csharp-sqliteto access it in a C# app using the same methods as that of SQL or OleDB.

您可以使用System.Data.SQLitecsharp-sqlite在 C# 应用程序中使用与 SQL 或 OleDB 相同的方法访问它。

You will also need an application to edit/manage the database. The best one in my opinion is SQLite Studio. Here are a couple more:
SQLite Admin
SQLite 2009 Pro (bottom of the page)
Update - 7/25/11 - More SQLite apps (question here on SO)

您还需要一个应用程序来编辑/管理数据库。我认为最好的一个是SQLite Studio。这里还有几个:
SQLite Admin
SQLite 2009 Pro(页面底部)
更新 - 2011 年 7 月 25 日 -更多 SQLite 应用程序(关于 SO 的问题)

Here's more on SQLite:
SQLite on Wikipedia
Companies that use SQLite

这里有更多关于 SQLite 的信息:
维基百科上的 SQLite
使用 SQLite 的公司

Custom Functions: As an addition, if you are looking in the SQLite Core Functionsand don't see one you like, you can create your own custom functions. Here are a couple of examples:
From SO
Anoter example

自定义函数:另外,如果您正在查看SQLite 核心函数但没有看到您喜欢的函数,您可以创建自己的自定义函数。这里有几个例子:
来自 SO
Anoter example

回答by Hugues Van Landeghem

Firebird embeddedcan be a good choice

Firebird 嵌入式可能是一个不错的选择

The embedded version is an amazing variation of the server. It is a fully featured Firebird server packed in just a few files. It is very easy to deploy, since there is no need to install the server.

嵌入式版本是服务器的一个惊人变体。它是一个功能齐全的 Firebird 服务器,仅包含几个文件。部署非常容易,因为不需要安装服务器。

There is some very good dot netdrivers

有一些非常好的dot net驱动程序

回答by Robert Mooney

If you are building a project with .NET 4.0.2 or greater and want embedded database support, consider SQL Server Express LocalDB.

如果您正在使用 .NET 4.0.2 或更高版本构建项目并需要嵌入式数据库支持,请考虑SQL Server Express LocalDB

It's a relatively new addition to the Express family that features a smaller installation footprint and reduced management overhead (when compared to other editions of Express), yet it maintains the programmability aspects of SQL Server. That is, unlike Compact Edition, LocalDB does not require the installation of a separate ADO.NET provider to communicate with SQL.

它是 Express 系列的一个相对较新的成员,具有更小的安装空间和更少的管理开销(与 Express 的其他版本相比),但它保持了 SQL Server 的可编程性方面。也就是说,与 Compact Edition 不同,LocalDB 不需要安装单独的 ADO.NET 提供程序来与 SQL 通信。

See the following for more details:

有关更多详细信息,请参阅以下内容:

SQL Express v LocalDB v SQL Compact Edition(MSDN Blogs)
SQL LocalDB vs SQL Server CE(Stack Overflow)

SQL Express v LocalDB v SQL Compact Edition(MSDN 博客)
SQL LocalDB 与 SQL Server CE(堆栈溢出)

回答by Moog

SQL Server Compact if you want to use the official microsoft solution. This has the advantage of being able to use replication with SQL server if you need that sort of thing.

SQL Server Compact 如果你想使用官方的微软解决方案。如果您需要那种东西,这具有能够将复制与 SQL 服务器一起使用的优点。

SQLite if you want to somthing very simple small and free. This is what android uses for it's internal databases so it is very well supported and there are very good .NET bindings available.

SQLite 如果你想要一些非常简单的小而免费的东西。这是 android 用于其内部数据库的内容,因此它得到了很好的支持,并且有非常好的 .NET 绑定可用。

One distinct advantage of SQLite is that it is cross-platform. So if you wanted to port your application to Mono.NET then you wouldn't have any modifications to make to the database implementation.

SQLite 的一个明显优势是它是跨平台的。因此,如果您想将您的应用程序移植到 Mono.NET,那么您无需对数据库实现进行任何修改。

I do not like MS Access for this solution but a lot of people have included it in their answer. It is limited due to the proprietary format and platform dependence. It does have it's advantages though. You can manipulate data easily if you have a copy of MS Access, you can build queries graphically and create macros. You can easily integrate it with the rest of MS Office.

我不喜欢 MS Access 用于此解决方案,但很多人已将其包含在他们的答案中。由于专有格式和平台依赖性,它受到限制。不过它确实有它的优点。如果您拥有 MS Access 的副本,则可以轻松操作数据,您可以以图形方式构建查询并创建宏。您可以轻松地将其与 MS Office 的其余部分集成。

Out of all these SQLite would be my recommendation due to it being so compact, well documented and supported by a growing army of fellow developers regardless of platform.

在所有这些 SQLite 中,我会推荐它,因为它非常紧凑、有据可查,并且受到越来越多的开发人员队伍的支持,无论平台如何。

EDIT

编辑

I realized that there is another option that everybody here forgot to mention

我意识到还有另一种选择,这里的每个人都忘了提及

So long as you don't need relational tables you could use CSV file read as a dataset via ADO.NET. (More of a lulz suggestion than anything else but would be suitable in some cases and doesn't require additional libraries for a MS deployment.

只要您不需要关系表,您就可以使用通过 ADO.NET 作为数据集读取的 CSV 文件。(更多的是 lulz 建议而不是其他任何建议,但在某些情况下是合适的,并且不需要额外的库来部署 MS。

回答by FIre Panda

You could use Sql Server Express Editionas its free and is equally powerful until and unless you want functionality like mirroringetc. Have a look at this.

您可以Sql Server Express Edition免费使用并且同样强大,除非您想要mirroring等功能。看看这个

回答by Jeremy Gray

I've used db4o with success.
File based, large community, simple to use.

我成功地使用了 db4o。
基于文件的大型社区,易于使用。

http://www.db4o.com/

http://www.db4o.com/

Licensing Details

许可详情

Free General Public License db4o is licensed under the GPL by default.

The GPL license is ideal if you plan to use db4o in house or you plan to develop and distribute your own derivative work as free software under the GPL as well.

Commercial License A commercial license is required if you want to embed db4o in a commercial non-GPL product. Commercial licensees gain access to premium services and support.

默认情况下,免费的通用公共许可证 db4o 在 GPL 下获得许可。

如果您计划在内部使用 db4o,或者您计划开发和分发您自己的衍生作品作为 GPL 下的免费软件,则 GPL 许可证是理想的。

商业许可证 如果您想将 db4o 嵌入商业非 GPL 产品中,则需要商业许可证。商业被许可人可以获得优质服务和支持。

回答by Rig

An alternative that hasn't been mentioned if you don't require it to be a free database is VistaDB. It's all managed code, provides tons of features for an embedded database, and offers pretty good performance. A pretty good bridge between SQL CE and SQL Server Express since the majority of your VistaDB stored procedures will run without modification in SQL Server Express. I've been pretty pleased with customer service at this point as well. I've been using it at work. No services to start. An empty DB is around 1MB and the DLL is pretty lightweight too. Has ADO.NET providers and such things. I liked it a good bit.

如果您不要求它是免费数据库,则尚未提及的替代方案是 VistaDB。它都是托管代码,为嵌入式数据库提供了大量功能,并提供了非常好的性能。SQL CE 和 SQL Server Express 之间的一个很好的桥梁,因为大多数 VistaDB 存储过程无需修改就可以在 SQL Server Express 中运行。在这一点上,我对客户服务也很满意。我一直在工作中使用它。没有要启动的服务。一个空的 DB 大约为 1MB,而 DLL 也非常轻巧。有 ADO.NET 提供程序之类的东西。我很喜欢它。

VistaDB

数据库

回答by panindra

SQL server Compact Edition best as it is free and Light in Size and integrates Well

SQL server Compact Edition 最好,因为它是免费的,体积轻巧,并且集成得很好