实体框架代码第一种方法 [英] Entity Framework Code First Approach

查看:60
本文介绍了实体框架代码第一种方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i希望使用Entity Framework Code创建两个表(具有主键和外键关系)第一种方法我的表就像那样

表1



CampId int PK Not Null

名称varchar(200)非null

StatusFKID int FK



和第二张表是表2



StatusID int PK

状态Varchar(100)

Hi All ,

i want to create two table(having primary and Foreign key relation) using Entity Framework Code first approach my tables are like that
Table1

CampId int PK Not Null
Name varchar(200) Not null
StatusFKID int FK

and second table is Table2

StatusID int PK
Status Varchar(100)

推荐答案

DIY通过检查出来https://msdn.microsoft.com/en-us/data/ee712907#codefirst [ ^ ]
DIY by checking this out https://msdn.microsoft.com/en-us/data/ee712907#codefirst[^]


这是实体框架101东西。每个教程都涵盖了这种情况。说真的,你需要谷歌的实体框架代码第一教程或你需要提取朱莉勒曼的书实体框架代码优先 [ ^ ]。



我强烈推荐这本书作为教程在线不要深入了解所需的知识真的明白发生了什么。
This is Entity Framework 101 stuff. Every tutorial out there covers this situation. Seriously, you need to either Google for "Entity Framework Code First Tutorials" or you need to pickup Julie Lerman's book "Entity Framework Code First[^]".

I would highly recommend the book as tutorials on-line don't go into the depth of knowledge required to really understand what's going on.


这篇关于实体框架代码第一种方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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