带有遗留实体模型的ORM(Nhibernate等)

I'm probably going to answer my own question in asking it but here goes...!

I'm investigating whether it is useful migrating parts of our legacy application to an ORM framework to take advantages of a strongly-typed domain model, validation, strongly-typed queries, etc.

However, our current design methodology is to build Dtos to flatten multiple complex entities into a single manageable object. This works very well since it gives the object a specific purpose and avoids any confusion when working with it. It is also useful in a web context since it is completely disconnected from the data layer.

The issue we are trying to solve is having a write lots of boilerplate code to query and update the database.

Moving on to the topic of using an ORM.

We don't particularly want to move away from Dtos due to the reasons stated above. I have evaluated both Entity Framework 4.1 (code-first) and NHibernate 3.1 (fluent) and can't get around the issue of how to update a complex Dto back into it's relevant entities.

e.g.

Let's say that I have a Customer Entity and an Address entity with the following CustomerAddress Dto:

class CustomerEntity {
public String ID {get;set;}
public String Name {get;set;}
public String Address1 {get;set;}
public String Address2 {get;set;}
}

I then want to send the updated properties back to the database through the entity models.

I have got as far as using AutoMapper to map the CustomerEntity back to the respective Customer/Address entities. However, I am forced to take a query hit on the database to retrieve the customer/address entities before the update is done.

Since our legacy database contains some tables with large numbers of columns, it seems an unnecessary performance hit to have to load each entity in full before updating.

Is there a way that I can write an command to only update specific properties of the entity or am I trying too hard to work against the ORM paradigm?

Thanks!

推荐文章

分页未绑定的gridview

分页未绑定的gridview

推荐文章

Java中的奇怪bug try catch finally

Java中的奇怪bug try catch finally

推荐文章

将两个访问表中的值相乘

将两个访问表中的值相乘

推荐文章

Android:Toast对异步任务onpostexecute()的响应相同

Android:Toast对异步任务onpostexecute()的响应相同

推荐文章

facebook图形API的批处理请求限制是多少?

facebook图形API的批处理请求限制是多少?

推荐文章

如何在WPF功能区控件中禁用隐藏/取消隐藏

如何在WPF功能区控件中禁用隐藏/取消隐藏

推荐文章

启动活动时使android小部件不可见

启动活动时使android小部件不可见

推荐文章

关于Tcl中名称空间的一个问题

关于Tcl中名称空间的一个问题

推荐文章

在android上安装应用程序时出现问题

在android上安装应用程序时出现问题

推荐文章

在服务中发送电子邮件(不提示用户)

在服务中发送电子邮件(不提示用户)

推荐文章

HttpPost后的模型更新

HttpPost后的模型更新

推荐文章

在java中设置文件密码保护

在java中设置文件密码保护

推荐文章

数据表数组

数据表数组

推荐文章

套接字编程:Inputstream卡在循环中-read()始终返回0

套接字编程:Inputstream卡在循环中-read()始终返回0

推荐文章

寻找一个问答PHP SQLite编辑解决方案

寻找一个问答PHP SQLite编辑解决方案

推荐文章

objective-c连接NSString

objective-c连接NSString