建模EF中的Facade类 [英] MOdelling Facade classes in EF

查看:81
本文介绍了建模EF中的Facade类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个helath carea应用程序,它有两个表(例如)患者和药物。我没有直接从/ GUI后面的代码中访问这两个表,而是决定使用一个Facade类,即patientFacade。


通过这个Patientfacade类,我想与患者和药物和称呼内在的方法..


我创造了患者和...来自DB的EF设计师的药物实体创建了一个新的实体,我自己创建了PatientFacade ..但是它显示为错误,说它没有数学与数据库的东西......我理解..


但是,为了强制执行Facade设计模式,我真的不确定如何在EF设计师中为Facde类添加实体..


如果有人帮我说,我真的很感激,如何为数据库实体创建外观类 在EF  vs2008中。


谢谢


Sena


Ace

解决方案

您无法在EF设计器中创建这样的外观实体。 如果没有它成为EF设计师的一部分,你没有理由不能在代码中创建外观类。


为什么你想让它在设计师中呢?


Hi,

I ve a helath carea application which has two tables(for example) Patient and medications. Instead of directly accessing these two tables from the code behind/GUI, i ve decided to use a facade class , the patientFacade.

Through this patientfacade class i would like to interface with both patient and medications and call the inner methods..

I ve created patient & medications entities on the EF designer from DB and created a new entity, the PatientFacade on my own..but it shows as error saying that it does not math witht the DB stuff..ok i understand..

But , to enforce a Facade design pattern , Am not really sure how to incude entities for Facde classes in EF designer..

I would really appreciate if somebody helps me to say ,how do one can create facade class for DB entities in EF in vs2008.

Thanks

Sena


Ace

解决方案

You cannot create a facade entity like that in the EF designer.  There's no reason why you can't create the facade class in code without it being part of the EF designer.

Why do you want it to be in the designer?


这篇关于建模EF中的Facade类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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