问题
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