2011-04-28 73 views
0

我有以下要求如何在实体框架4.0中的两个表之间添加关系

我在EF中有一个表和相应的实体。现在我的代码将图像插入到下表中。

PatientChartImages(
    PatientChartImageId guid, 
    PatientChartId guid, 
    NoOfImages int, 
    PatientChartImage varBinary(Max) 
) 

我必须创建一个单独的表并存储图像而不是PatientChartImages表。

PatientChartImagesSource(
    PatientChartImageId, 
    PatientChartImage varBinary(Max) 
) 

是否有一个的EntityFramework方式,所以,每当我指PatientChartImages的PatientChartImage,PatientChartImagesSource的PatientChartImage被称为。这样我就不必更改我的DAL。请建议。

回答

0

是的,有一种方法。这种情况被称为Entity splitting。您必须在PatientChartImages和PatientChartImagesSource之间的主键上创建一对一关系才能使用它。

相关问题