Managing inheritance using Fluent NHibernate

こ雲淡風輕ζ 提交于 2019-12-12 06:12:59

问题


I am working on a rather strange scenario here : We have a class that users can search over them. For some performance reason I'd like to have a view in our database that practically provide the same information and I do the search over this view .

For the sake of simplicity let say out class name is Entity :

public class Entity{
 .....
}

We are passing the search filters as an Expression<Func<Entity,bool>> so I need my view be inherited from Entity then I have created an EntiyView class like this :

public class EnitiyView:Entity
{
.........
}

The problem is this way when I make my model using Fluent NHibernate It correctly generates a model so that EntityView is an Entity and It tries to join view and table using a field that it does not exist(Entity_id).

I thought may be I could use IgnoreBase to solve this problem but IgnoreBase ignore the Entity completely which is not intended.

So the question is how can I tell Fluent NHibenrate that I want EntityView be a child of Entity only in code and I don't them to be related like this in Database ?

来源:https://stackoverflow.com/questions/30413401/managing-inheritance-using-fluent-nhibernate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!