选择数据库和ORM的.NET项目 [英] Choosing Database and ORM for a .NET project

查看:110
本文介绍了选择数据库和ORM的.NET项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Silverlight客户端上的.NET应用程序。现在我来,我想扔我的静态虚拟数据在服务器端,并添加一个数据库,而不是点。

I'm working on a .NET application using Silverlight on the client side. Now I've come to the point where I want to throw out my static dummy data on the server side and add a database instead.

有关数据库我喜欢使用其中一个ORM的,我可以简单地标记我的模型类和数据库表是专门为我。我与Groovy和Grails的更早一些测试,并认为GORM做了一个平稳的工作。什么是建立在.net数据库的最佳方法是什么?

For the database I'd love to use one of them ORM's where I can simply tag my model classes and the database tables are built for me. I did some tests with Groovy and Grails earlier, and thought GORM did a smooth job. What's the best way to set up a database in .Net?

这令我就是用NHibernate的第一件事。我真的不知道NHibernate的东西,但我听说很多人提到它的热情。但后来我看到ADO的.Net也是一个ORM,它是建立在框架..没有NHibernate的outbeat ADO?而这是怎么回事使用LINQ?我看到的上市作为一个ORM过,但我虽然LINQ是多为查询的一部分?我可以定义,通过LINQ的数据库?

The first thing that strikes me is to use nHibernate. I don't really know anything about nHibernate, but I've heard numerous people mention it with enthusiasm. But then I see that ADO .Net also is an ORM, which is built into the framework.. Does nHibernate outbeat ADO? And what's the deal with LINQ? I see that's listed as an ORM too, but I though LINQ was more for the query part? Can I "define" the database through LINQ?

任何意见和建议,欢迎。我也很想听听,如果你有使用什么数据库的意见。我认为MS SQL Server是最容易的选择?

Any comments and recommendations are welcome. I'd also love to hear if you have opinions on what database to use. I assume MS SQL Server is the easiest choice?

推荐答案

NHibernate和Silverlight的:

一个NHibernate的贡献者,Ayende Rahien,最近发布的博客文章有关NHibernate和Silverlight的:

One of the NHibernate contributors, Ayende Rahien, recently posted a blog post about NHibernate and Silverlight:

我有关于NHibernate和Silverlight的几个问题。这其实是一个很容易的事情来回答。

I got a few questions about NHibernate and Silverlight. That is actually a very easy thing to answer.

想都别想。他们合不来。事实上,他们甚至没有去相处。

Don’t even try. They don’t get along. In fact, they aren’t even going to get along.

Silverlight不具有System.Data.IDbConnection,您可以放心地认为,重要的是NHibernate的比较重要的。

Silverlight doesn’t have System.Data.IDbConnection, and you can safely assume that that it somewhat important to NHibernate.

所以,为了访问本地数据库运行的NHibernate内的Silverlight应用程序,presumably超出。但我不认为这是大多数人心中竟然出现时,他们问的NHibernate和Silverlight。他们想知道NHibernate的客户端上的服务器和Silverlight上。

So, running NHibernate inside a Silverlight application, presumably in order to access a local database is out. But I don’t think that this is what most people actually had in mind when they ask about NHibernate and Silverlight. They want to know about NHibernate on the server and Silverlight on the client.

这是很容易回答的很好,这是去上班,就像任何客户机/服务器系统。所有的规则同样适用。

And that is easy enough to answer as well, it is going to work just like any client / server system. All the same rules apply.

所以应该NHibernate的,只要你不打算直接使用它从Silverlight客户端工作。

So NHibernate should work as long as you don't plan to use it directly from the Silverlight client.

NHibernate的:

NHibernate的是一个伟大的ORM,但它有一个非常陡峭的学习曲线,所以你应该ppared一些时间来投入到如果你选择NHibernate的学习框架$ P $。如果你作出这样的投资你会被的灵活性和力量,NHibernate的规定给予奖励。

NHibernate is a great ORM but it has a quite steep learning curve, so you should be prepared to invest some time into learning the framework if you choose NHibernate. If you make that investment you will be rewarded by the flexibility and power that NHibernate provides.

城堡ActiveRecord的:

城堡ActiveRecord的是一个框架,它是建立在NHibernate的顶部,因此颇为相似NHibernate的。它降低了学习曲线一点,因为它增加了一些额外的抽象。顾名思义它是构建与ActiveRecord的模式中使用,并包括一个基类,让你相当多的功能,如果你不介意使用自己的ActiveRecord基类。

Castle ActiveRecord is a framework that is build on top of NHibernate, and hence is quite similar to NHibernate. It reduces the learning curve a bit, since it adds some additional abstractions. As the name implies it is build for use with the ActiveRecord pattern, and includes a base class that gives you quite a lot of functionality if you don't mind using their ActiveRecord base class.

的LINQ to SQL:

LINQ to SQL和ADO.NET实体框架是两种的ORM:■包含在.NET框架。 LINQ to SQL的比实体框架更小,更简单的框架,但它有一些不错的功能,并且很容易上手。

LINQ to SQL and the ADO.NET Entity Framework are two ORM:s that are included in the .NET Framework. LINQ to SQL is a smaller and simpler framework than Entity Framework, but it has some nice features, and is quite easy to get started with.

实体框架:

实体框架是很容易上手的,但是它在当前版本的几个比较大的问题,因为它仍然是在1版本然而,实体框架的下一个版本将改善和解决了许多当前的缺点。

Entity Framework is quite easy to get started with as well, but it has a few quite big problems in the current version, since it is still in version 1. However, the next version of Entity Framework will improve and fix many of the current shortcomings.

LINQ和架构生成的框架:

所有这些框架都使用LINQ作为查询语言的支持。 LINQ to SQL和NHibernate的可以为你根据你的域类和映射生成模式。实体框架不能产生v1的模式,但V2将添加的功能。

All of these frameworks have support for using LINQ as the querying language. LINQ to SQL and NHibernate can generate a schema for you based on your domain classes and mapping. Entity Framework can not generate a schema in v1, but v2 will add that functionality.

这篇关于选择数据库和ORM的.NET项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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