EF CTP4中的关系 [英] Relationship in EF CTP4

查看:85
本文介绍了EF CTP4中的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了EntityFramework CTP4,但找不到任何"Relationship()"在  EntityConfiguration<>。


我在哪里可以找到它?


 


谢谢,


PG


 

解决方案

PG,


 


用于指定关系的流畅API在CTP3和CTP4之间进行了更改。&NBSP;
CTP4 Code First演练解释了这一变化:


 


http://blogs.msdn.com/b /adonet/archive/2010/07/14/ctp4codefirstwalkthrough.aspx


 


这篇文章解释了如何删除Relationship方法,所以不要做这样的事情:


 


builder.Entity< Book>()。关系(b => b.Author).IsRequired()。FromProperty(a => a.Books);


 


您现在可以执行以下操作:


 


builder。实体< Book>()。HasRequired(b => b.Author).WithMany(a => a.Books);


 


博客文章中有更多详细信息。


 


谢谢,


< span style ="font-family:Calibri"> Arthur


&NBSP;


I downloaded the EntityFramework CTP4 but cannot find any "Relationship()" in  EntityConfiguration<>.

Where can I find it?

 

Thanks,

PG

 

解决方案

PG,

 

The fluent API for specifying relationships was changed between CTP3 and CTP4.  The CTP4 Code First walkthrough explains this change:

 

http://blogs.msdn.com/b/adonet/archive/2010/07/14/ctp4codefirstwalkthrough.aspx

 

This post explains how the Relationship method has been removed, so instead of doing something like this:

 

builder.Entity<Book>().Relationship(b => b.Author).IsRequired().FromProperty(a => a.Books);

 

you would now do something like this:

 

builder.Entity<Book>().HasRequired(b => b.Author).WithMany(a => a.Books);

 

There are more details in the blog post.

 

Thanks,

Arthur

 


这篇关于EF CTP4中的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆