It's possible to map a VIEW using Fluent NHibernate? If so, how?
Asked
Active
Viewed 4,023 times
2 Answers
19
I would think you could just replace your the table name with your view name using the WithTable method:
WithTable("myview");
Edit: Just to update this answer, Fluent NHibernate now uses:
Table("myview");
-
2What if this view doesn't have any primary key? – Johnny_D Apr 26 '12 at 10:33
3
mxmissile's answer is correct but I wanted to add that the view will have to be updateable (SQL Server term.) if you want to do inserts or updates against it. I have several tables mapped against views that filter out inactive records because these tables allow soft deletes.

Jamie Ide
- 48,427
- 16
- 81
- 117
-
1If I recall, these "updateable" views are title Indexed Views? It's been awhile since I had to deal with this stuff. – mxmissile May 12 '09 at 22:04