问题描述
有人能告诉我一种使用WCF服务从两种不同数据模型执行数据同步的方法。
要求如下:
数据模型-A具有实体框架生成的对象,需要与外部数据模型-B映射。
例如:
数据模型 - 答:具有相互关联的X1,X2,X3 ...表格。
数据模型 - B:有Y1,Y2,Y3 ......相互关联的表。
让我们假设X1 - 表有5列,名称为A1,A2 ,A3,A4,A5(A5本身可能是一个enity)。
Y1 - 表有3列,名称为B1,B2,B3。
我需要更新X1的A4,A5中的B1,B2值。这里就像B1-A4是一对一的映射,
其中B2-A5是一对多的映射。
我的实现方法是:
方法-1:
在Entity Framework中查找方法来定义通过OData接口公开的数据模型-B的实体对象,必须与数据模型-A映射。
方法-2。
在目标系统中创建SQL数据库表OData接口。
通过实体框架将此数据表转换为实体对象。
使用Entity框架工具定义映射,将其映射到数据模型-A并保存映射文件。
集成服务必须读取此映射文件并使用实体框架工作API进行同步。
如果有,请告诉我是更好的方法,也需要示例。
Hi,
can anyone tell me an approach to perform data synchronization from two different data models using WCF services.
Requirement is as follows:
Data model-A has entity framework generated objects which needs to be mapped with the external Data model-B.
For example:
Data model - A: has X1,X2,X3... tables that are associated with each other.
Data model - B: has Y1,Y2,Y3... tables that are associated with each other.
let us assume X1 - Table has 5 columns with name A1,A2,A3,A4,A5 (A5 itself may be an enity).
Y1 - Table has 3 columns with name B1,B2,B3.
I need to update B1,B2 values in A4,A5 of X1. here it will be like B1-A4 is one-to-one mapping,
where as B2-A5 is one-to-many mapping.
My approach of implementation is:
Approach-1:
Find methods in Entity Framework to define entity objects of the data model-B which is exposed through OData interface, which has to be mapped with data model-A.
Approach-2.
Create SQL database table in the destination system out of the OData interface.
Convert this data table as entity objects through the Entity Framework.
Define the mapping with the Entity framework tool to map it with data model-A and save the mapping file.
Integration service has to read this mapping file and do the sync-up using entity frame work APIs.
Please let me know if there is any better approach and sample example is needed as well.
推荐答案
这篇关于需要有关数据同步应用的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!