重用EF,将POCO类更改为指向视图 [英] Reuse EF , change POCO classes to point to views

查看:95
本文介绍了重用EF,将POCO类更改为指向视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重用现有的项目代码。我可以从旧项目中获得所有POCO类(表的副本),该项目也附加到DBCOntext。



但是在我的新项目中,我的数据库结构不同。我正在计划用新的POCO类替换具有相同名称和结构的新POCO类,但它们将在DB中查看(而不是表格)。



是否可以在EntityFramwork中使用6?如果是的话怎么样?有没有其他方法来处理这个问题。



提前谢谢!!!

I want to reuse an existing project code. I have all the POCO classes(replica of tables) available with me from the old project which is attached to DBCOntext also.

However in my new project my DB structure is different. I am planing to replace the old POCO classes with new ones with same name and structure but they will be view(not tables) in DB.

is it possible in EntityFramwork 6? if yes then how? Is there any other way to deal with the this problem.

Thanks in advance!!!

推荐答案

确定。奇怪的。您确实意识到您将无法将任何内容写回数据库,对吗?



如果您在原始解决方案中拥有所有EF代码一个单独的项目,完全独立于应用程序代码,您不必重新创建新解决方案中的所有内容。您只需重复使用旧的EF项目。
OK. Weird. You do realize you won't be able to write anything back to the database, correct?

If you had, in your original solution, all of the EF code in a seperate project(s), completely seperate from the application code, you wouldn't have to recreate everything in your new solution. You just reuse the old EF project.


这篇关于重用EF,将POCO类更改为指向视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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