使用实体框架将表添加到数据库 [英] Add table to database using entity framework

查看:82
本文介绍了使用实体框架将表添加到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将实体添加到数据库中。最初我从模型更新了数据库,现在我在模型上创建了一个新实体,现在我想将这个实体添加到数据库中。我怎么能这样做



我的edmx的初步外观如下



http://imageshack.us/photo/my-images/194/samplegk.jpg/ [ ^ ]



我通过右键单击添加实体并选择添加实体并根据需要进行相应映射,现在我的edmx看起来如下



http://imageshack.us/photo/my-images/72/sample1s.jpg/ [< a href =http://imageshack.us/photo/my-images/72/sample1s.jpg/target =_ blanktitle =New Window> ^ ]



现在我想将此表 DeptHead 更新到数据库

Is it possible to add an entity to a database. Initially I have updated a database from a model, now I created a new entity on the model, now I would like to add this entity to the database. How can I do this

Initial look of my edmx is as follows

http://imageshack.us/photo/my-images/194/samplegk.jpg/[^]

I added an entity by right clicking and select add entity and mapped accordingly as per required, now my edmx looks as follows

http://imageshack.us/photo/my-images/72/sample1s.jpg/[^]

Now I would like to update this table DeptHead to the database

推荐答案

检查此答案如果你得到一些帮助:

点击此处 [ ^ ]
Check this answer if you get some help out:
Click here[^]


这篇关于使用实体框架将表添加到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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