开发者

How to add relationship between two tables in Entity Framework 4.0

I have the following Requirement

I have a Table and corresponding entity in EF. Now my code is inserting Images to DB in the following table.

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

I have to create a seperate table and store Images in it ins开发者_运维技巧tead of PatientChartImages Table .

PatientChartImagesSource(
    PatientChartImageId,
    PatientChartImage varBinary(Max)
)

Is there a way in EntityFramework, So that whenever i refer to PatientChartImage of PatientChartImages,PatientChartImage of PatientChartImagesSource is referred. This way i won't have to change my DAL. please suggest.


Yes there is a way. This scenario is called Entity splitting. You must create one-to-one relation on primary keys between PatientChartImages and PatientChartImagesSource to use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜