实体框架(实体从EntityObject到DTO然后再到EntityObject)是否可以在此时轻松地在db中更新它?

时间:2021-08-23 17:36:15

i think my whole questions is inside title bar =] but i'll explain little more.

我认为我的所有问题都在标题栏内=]但我会解释一下。

i've got 2 related tables in database ( Customers and Orders ) and wcf service which returns Customer and all related Orders as DTO's like this :

我在数据库(客户和订单)和wcf服务中有2个相关表,它将客户和所有相关订单作为DTO返回如下:

class CustomerDto
{
int ID;
IList< OrderDto > Orders;
}
and :
class OrderDto
{
int ID;
string someString;
}

class CustomerDto {int ID; IList 订单; }和:class OrderDto {int ID; string someString; }

what is happening:
client asks for customer (customer is returned with orders ), makes some changes (adds/removes orders, changes someString), and sent data back to service.

发生了什么:客户要求客户(客户退回订单),进行一些更改(添加/删除订单,更改someString),并将数据发送回服务。

here i wanted to ask, is it possible to attach modified Customer to database context, or i'll need make changes manually?

在这里我想问一下,是否可以将修改后的客户附加到数据库上下文,或者我是否需要手动进行更改?

Thank You !

谢谢 !

1 个解决方案

#1


Here's an article with downloadable code sample on using EF and WCF together, including updates. You can also look at RIA services.

这是一篇关于使用EF和WCF一起使用的可下载代码示例的文章,包括更新。您还可以查看RIA服务。

#1


Here's an article with downloadable code sample on using EF and WCF together, including updates. You can also look at RIA services.

这是一篇关于使用EF和WCF一起使用的可下载代码示例的文章,包括更新。您还可以查看RIA服务。