Does NHibernate support SQL mapping?

Does NHibernate support VIEWS SQL matching? Any examples would be helpful.

+4
source share
3 answers

Yes. You can update or insert into views in SQL Server if certain conditions are met, see the section Updatable Views in the documentation. I know this applies to SQL Server 2005+, I do not know about earlier versions.

If the view is not updated, you can declare the display as read-only.

+4
source

Yes, just use your view name instead of the table name in the mapping configuration. Of course, it will throw an exception if you try to update it.

eg:.

<class name="someclass" table="vw_someview"> ... </class> 
+9
source

The simple answer is yes.

Just put your name in the places where the table name is usually written in all examples. It. Views and tables are interchangeable - provided that the view can be written without restrictions ...

Thomas

+2
source

All Articles