添加POCO实体 [英] Adding POCO Entities

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

问题描述

我有一个EDMX与context.tt和.TT的文件中。
我有POCO类.TT下的文件。

I have an EDMX file with context.tt and .tt file. I have POCO classes under .tt file.

我还有一个EDMX与POCO的文件。

I have one more EDMX with POCO files.

我想从第二EDMX一些POCO类复制到1 EDMX。

I want to copy some POCO classes from 2nd EDMX to 1st EDMX.

请记住,这些表在两个不同的EDMX

Please keep in mind that the tables are different in both the EDMX.

只是想看看它可以在一个POCO类从EDMX和.TT文件复制到
另一回事。

Just wanted to find out if its possible to copy one POCO class from EDMX and .tt file to another.

任何帮助将是AP preciated。

Any help would be appreciated.

推荐答案

解决方案很容易。更改EDMX文件的ConnectionString。

Solution was easy. Change the connectionstring of EDMX file.

在我来说,我必须创建一个2功能进口同一个存储过程,每一个指向不同的数据库。

In my case I had to create a 2 Function imports for same stored procedure, each pointing to different databases.

所以,我创建了用RT-点击存储过程的新功能导入在模型浏览器。

So I have created a new Function Import by rt-clicking on stored procedure in Model Browser.

在功能导入我们必须创建复杂类型的选项。我需要因为在存储过程中使用一个表是具有不同的列来创建新的复杂类型。

In Function Import we have option of creating Complex type. I needed to create a new Complex type since one table used in stored proc was having different columns.

一旦创建了进口功能,只需关闭模型浏览器和构建解决方案。

Once the Function import is created, just close the Model browser and build the solution.

IDE将提示输入文件名和新context.tt和.TT文件将被创建。就在新的POCO实体复制到现有.TT文件。

IDE will prompt for file name and new context.tt and .tt file will be created. Just copy the new POCO entities to the existing .tt file.

现在我们有2个功能导入和2 POCO enties。现在,我们可以指向数据库和东西会工作。

Now we have 2 Function Imports and 2 POCO enties. Now we can point to either of Databases and things would work.

希望帮助的人被困在类似的方案。

Hope that helps for anyone stuck in similar scenario.

这篇关于添加POCO实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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