您建议将哪个数据库与 C# (.NET) 应用程序一起使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/174059/
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
Which database would you recommend to use with C# (.NET) application?
提问by Skuta
I'm developing a little project plan and I came to a point when I need to decide what local databse system to use.
我正在制定一个小项目计划,当我需要决定使用什么本地数据库系统时,我遇到了一个问题。
The input data is going to be stored on webserver (hosting - MySQL DB). The idea is to build a process to download all necessary data (for example at midnight) and process them. However, there are going to be many inputs and stages of processing, so I need to use some kind of local database to store the semi-product of the application
输入数据将存储在网络服务器(托管 - MySQL DB)上。这个想法是建立一个过程来下载所有必要的数据(例如在午夜)并处理它们。但是,会有很多输入和处理阶段,所以我需要使用某种本地数据库来存储应用程序的半产品
What local database system would you recommend to work with C# (.NET) application?
您建议使用哪种本地数据库系统来处理 C# (.NET) 应用程序?
edit: The final product (information) should be easily being exported back to Hosting MySQL DB.
编辑:最终产品(信息)应该很容易被导出回托管 MySQL 数据库。
As Will mentioned in his answer - yes, I'm for a performance AND comfort of use.
正如 Will 在他的回答中提到的 - 是的,我是为了性能和使用舒适度。
采纳答案by ullmark
I want to say Microsoft Sql 2005 Express, as it (almost) comes as the obvious choice when developing in .NET.
我想说的是 Microsoft Sql 2005 Express,因为在 .NET 中进行开发时,它(几乎)是显而易见的选择。
But it all depends on what previous db skills you have. If you already know MySql and as you already said, the data should be exported back to MySql. Why not use MySql all the way?
但这一切都取决于您以前拥有的数据库技能。如果您已经知道 MySql 并且正如您已经说过的那样,则应将数据导出回 MySql。为什么不一直使用MySql?
回答by Joseph Daigle
MS SQL Server support comes out of the box without any other drivers or setup required. Also, MS SQL Server Express is free.
MS SQL Server 支持开箱即用,无需任何其他驱动程序或设置。此外,MS SQL Server Express 是免费的。
You can generate scripts that will export the data to/from MySQL.
您可以生成将数据导出到 MySQL 的脚本。
回答by ullmark
For quick and dirty I'd go with Sql Server Compact Edition.Its an in-process implementation of Sql Server, so it doesn't require you install any other applications.
为了快速和肮脏,我会使用Sql Server Compact Edition。它是 Sql Server 的进程内实现,因此不需要您安装任何其他应用程序。
Back in the day, you'd use an Access database for this kind of thing. But Access databases kinda blow.
过去,您会使用 Access 数据库来处理此类事情。但是访问数据库有点打击。
It wouldn't take much to upload your finished data back to the production server. If you're looking for a solution that automates that process, you'll probably need to look at hosting an instance of MySql locally and use whatever replication services it provides.
将完成的数据上传回生产服务器不会花费太多时间。如果您正在寻找自动执行该过程的解决方案,您可能需要考虑在本地托管 MySql 实例并使用它提供的任何复制服务。
回答by Oli
The "obvious" choice would be MS SQL Server Express. VS and .net both support it natively and if you've experience with it already (for the main DB), I'd certainly be tempted to stick with it (or its express version).
“显而易见”的选择是 MS SQL Server Express。VS 和 .net 本身都支持它,如果您已经使用过它(对于主数据库),我当然会坚持使用它(或其快速版本)。
But that's certainly not the end of your options. I use SQLite a lot for cross-platform applications and web-apps. It's eye-wateringly-fast and it does integrate pretty well through System.Data.SQLite-- albeit not as tightly as MS SQL Server.
但这当然不是您选择的结束。我经常将 SQLite 用于跨平台应用程序和 Web 应用程序。它的速度令人眼花缭乱,并且通过System.Data.SQLite集成得非常好——尽管不像 MS SQL Server 那样紧密。
There's also a Compact edition of SQL Server that compares quite well to SQLite.
还有一个精简版的 SQL Server,与 SQLite 相当。
回答by Corey Trager
For what you described, definitely MS SQL Server. Good performance, good tools. Free.
对于您所描述的,绝对是 MS SQL Server。性能好,工具好。自由。
回答by Goran
How about using db4o? It's an OODB you can embed in your application. Also supports replication. Edit: As a side note - In my current pet project using db4o I have a line (C# 3.5):
使用 db4o 怎么样?它是一个 OODB,您可以嵌入到您的应用程序中。还支持复制。编辑:作为旁注 - 在我当前使用 db4o 的宠物项目中,我有一行(C# 3.5):
IList<Users> list = Persistence.Database.Query<Users>(u => u.Name == "Admin");
Using strong typed lambda expression to get a (lazy) list of objects from the database. It also uses indexes to retrieve the list quickly.
使用强类型 lambda 表达式从数据库中获取(惰性)对象列表。它还使用索引来快速检索列表。
回答by Joel Coehoorn
I don't know of a good in-process database that is fully syntax and type compatible with MySQL. With that in mind, you have three options:
我不知道有一个很好的进程内数据库,它的语法和类型与 MySQL 完全兼容。考虑到这一点,您有三个选择:
- Choose something like SQLlite, Access, or SQL Server Compact. The problem is that you'll end up writing some complex conversion logic with any of those and have to write all your queries twice.
- Install MySQL locally. Then you have to put up with having a full database server running on your local system. You definitely want to avoid this for anything you'll ship to a customer, but for your own use it might be ok. Fortunately, MySQL doesn't use as many resources as some other modern database servers, but this is still less than ideal.
- Switch to SQL Server Express edition at the server and use SQL Server Compact at the client. It's just as cheap as MySQL (maybe even cheaper, since you're supposed purchase MySQL for any commercial use). Considering that you're using C# at the client end, you might want to use it with ASP.Net at the server side as well. And if you're using ASP.Net server side, then it's not difficult to find a host that offers SQL Server Express. Now your databases are type compatible and any query you write for you client is guaranteed to work for your server as well.
- 选择 SQLlite、Access 或 SQL Server Compact 之类的内容。问题是您最终会使用其中任何一个编写一些复杂的转换逻辑,并且必须两次编写所有查询。
- 在本地安装 MySQL。然后,您必须忍受在本地系统上运行完整的数据库服务器。对于将要运送给客户的任何东西,您肯定希望避免这种情况,但对于您自己的使用,这可能没问题。幸运的是,MySQL 使用的资源不如其他一些现代数据库服务器多,但这仍然不够理想。
- 在服务器上切换到 SQL Server Express 版并在客户端使用 SQL Server Compact。它和 MySQL 一样便宜(甚至可能更便宜,因为您应该为任何商业用途购买 MySQL)。考虑到您在客户端使用 C#,您可能还希望在服务器端将它与 ASP.Net 一起使用。如果您使用的是 ASP.Net 服务器端,那么不难找到提供 SQL Server Express 的主机。现在您的数据库是类型兼容的,并且您为客户端编写的任何查询都保证也适用于您的服务器。
IMO, one of the big strengths of the MS database stack (excluding access) is that they have a compatible solution for whatever you're doing all the way from the desktop up to multi-datacenter clusters. If your app's scale changes or you need to ship data between two different classes of app, your database layer is taken care of.
IMO,MS 数据库堆栈(不包括访问)的一大优势是它们具有兼容的解决方案,适用于从桌面到多数据中心集群的所有操作。如果您的应用程序的规模发生变化,或者您需要在两个不同的应用程序类之间传送数据,您的数据库层就会得到处理。
回答by BFree
I say go with Sql Server Compact Edition. It's real similar to the full blown version of SQL Server, and VS2008 has built in support for designing tables, querying etc. (Management Studio 2008 also has support for it). The biggest downside is that you lose out on stored procedures, but the upside is great as there's no need to install anything on the local users machine, and it works real fast for selecting data. Even cooler, is that with SQL Metal, you can create a DBML file and use LINQ just as you would with Sql Server.
我说使用 Sql Server Compact Edition。它与 SQL Server 的完整版本非常相似,并且 VS2008 内置了对设计表、查询等的支持(Management Studio 2008 也支持它)。最大的缺点是你失去了存储过程,但优点是很大,因为不需要在本地用户机器上安装任何东西,而且它选择数据的速度非常快。更酷的是,使用 SQL Metal,您可以创建 DBML 文件并使用 LINQ,就像使用 Sql Server 一样。
回答by chills42
Pick anything that's available, but code against interfaces only, that way you can easily switch between them.
选择任何可用的东西,但只针对接口编写代码,这样您就可以轻松地在它们之间切换。
For production, I'd say either MS SQL for large projects, (or express for mid level) simply because of the close integration with VS and Sqlite for smaller projects.
对于生产,我会说要么是用于大型项目的 MS SQL,要么是用于中级项目的 Express,仅仅是因为与 VS 和 Sqlite 的紧密集成用于较小的项目。
Given the description, I would think that Sqlite would be a good choice, since it's the simplest/lowest overhead.
鉴于描述,我认为 Sqlite 将是一个不错的选择,因为它是最简单/最低的开销。
回答by Chad Moran
I've been doing some testing as of late and though I'd also recommend SQL Server 2005 (Express if needed) because it works out of the box though SQL Server 2008 is new and RTM'd now.
我最近一直在做一些测试,虽然我也推荐 SQL Server 2005(如果需要,Express),因为它开箱即用,尽管 SQL Server 2008 是新的并且现在是 RTM。