在实体框架4.0中将新实体添加到模型中 [英] Adding New entities to model in entity framework 4.0

查看:67
本文介绍了在实体框架4.0中将新实体添加到模型中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我创建了一个模型并使用这个模型生成了数据库。



我使用我的UI(电影类中的AddMovielist() - >方法)向数据库添加了一个列表




MY UI有Moviename文本框,用户可以在此文本框中添加此字段



MOVIE数据库中的字段是MOVie ID(GUID) 和MovieName



我创建了一个dll 使用上述申请...
$


**************



现在我 创建了另一个应用程序并添加了上面的应用程序dll作为参考



现在我在UI中有3个字段  (1.导演姓名2.release date 3.Moviename)
$




当我更新我的电影名称时


电影名称应保存在我的电影数据库中,导演名称,发布日期应保存在其他数据库中,该数据库应根据MOVie ID(GUID)动态生成。


任何人都可以建议我如何解决这个问题..




先谢谢



Dazz


dazz的


Hi ,

I created a model and generated the Database using this model.

and i added a list to the database using my UI (AddMovielist()--> method in Moviesclass)


MY UI have Moviename text box where the user can add this field to the database

The fields in the MOVIE database are MOvie ID(GUID)  and MovieName

and i created a dll  using the above application...

**************

NOW i  created an other application and added the above application dll as reference

Now i had 3 fields in the UI  ( 1.Director name 2.release date 3.Moviename )


When i update my movieName

The movie name should be saved in my movie database and Director name ,release date should be saved in an other database which should be dynamically generated with refrence to the MOvie ID(GUID) .

Can any one suggest me how to solve this ..


Thanks in Advance

Dazz


dazz's

推荐答案

让我确定我理解:你有两个独立的数据库,其中一个持有电影,另一个持有导演的名字和发布日期?

Let me make sure I understand: You have two separate databases, one of which holds movies and the other holds director names and release dates?

在这种情况下,你需要做的就是先保存电影到你的电影数据库。然后,使用在更新其他数据库中的控制器和电影信息时执行此操作时生成的GUID。

In that case, what you need to do here is first save the movie to your movies database. Then, use the generated GUID that is returned when you do this when you update the director and movie information in the other database.

您需要两个实体模型,当然,一个用于每个数据库。

You'll need two entity models, of course, one for each database.

HTH,

  Noam

HTH,
 Noam


这篇关于在实体框架4.0中将新实体添加到模型中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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