为存储过程创建类,从多个表返回数据 [英] creating class for stored procedure, returning data from multiple tables

查看:95
本文介绍了为存储过程创建类,从多个表返回数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储过程,该过程从多个表返回数据.在nhibernate中,我们为每个表创建类.是否需要为要返回的每个表创建类,然后将该类彼此关联. 还有其他方法吗 就像创建一个包含存储过程返回的所有字段的类

I have an stored procedure returning data from multiple tables. in nhibernate we create class for each table. is it required to create class for each table it is returning and then relating that class with each other. is there any other way of doing it like creating a class that contain all the fields returned by stored procedure

谢谢

推荐答案

我还没有使用存储过程,但是您绝对可以创建一个映射到视图而不只是表的类.

I haven't worked with stored procedures, but you can definitely create a class that maps to a view and not just to a table.

顺便说一句,如果您使用的是QueryOver,则可以使用Select方法返回自定义对象:

By the way, if you're using QueryOver, you can use the Select method to return custom objects: http://nhforge.org/blogs/nhibernate/archive/2009/12/17/queryover-in-nh-3-0.aspx#Projections

这篇关于为存储过程创建类,从多个表返回数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆