Does NHibernate support mapping of SQL VIEWS? Any examples would be helpful.
Yes, just use your view name instead of the table name in your mapping config. Of course it will throw an exception if you try to update though.
e.g.:
<class name="someclass" table="vw_someview">
...
</class>
Yes. You can update or insert to views in SQL Server if certain conditions are met, see the Updateable Views section in the documentation. I know this applies to SQL Server 2005+, I don't know about earlier versions.
If the view is not updateable, you can declare the mapping as read-only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With