实体数据模型 - 导出到 Visual Studio 中的其他解决方案
这里有一个新手问题...
我在一个项目中创建了一个实体数据模型(.edmx)文件,现在它坐在那里,看起来很漂亮,定义了复杂的类型,图表的间距也正确。
然后我开始了一个新项目并尝试通过将其添加到项目中来重用相同的文件...我收到一堆错误,说它没有指向正确的项目...
我尝试将整个模型复制到新模型中并得到一堆引用错误。
我该怎么做?当然,它不会这么难...
我当然可以从数据库导入,但我没有得到复杂的类型等,重新映射它们是 PIA。
a newbie question here...
I've created an entity data model (.edmx) file in one project and now it's sitting there looking beautiful with complex types defined and diagrams all spaced properly..
Then I started a new project and try to reuse the same file by adding it to the project... I get a bunch of errors sayings it's not pointing to the right project...
I tried to just copy the entire model into a new model and get a bunch of reference errors.
How do I do this? surely it can't be this hard...
I can of course import from the database but I don't get the complex types etc and remapping them is PIA.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您喜欢刚刚所做的事情,则不必导入模型...如果您创建新解决方案,您可以“添加现有项目”,它将正确传输。
只需确保在执行此操作时正确设置连接字符串
这将使 EF 逻辑与新项目分开...另外,如果您想要的话,该项目可以在其他项目中重用...
这也将让你在洋葱架构路径上...
You shouldn't have to import the model if you love what you just did... if you create a New Solution, you can "Add Existing Project" and it will transfer properly.
Just make sure your connection strings are set correctly when you do this
This will keep the EF logic separate from the new project... Plus that project becomes reusable in other projects if that's what you want...
This will also keep you on the Onion Architechture path...