SubSonic 和存储过程

编程入门 行业动态 更新时间:2024-10-26 18:16:17
本文介绍了SubSonic 和存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用 SubSonic 时,您是将数据作为数据集返回,还是将其放入强类型自定义集合或通用对象中?

When using SubSonic, do you return the data as a dataset or do you put that in a strongly typed custom collection or a generic object?

我运行了 subsonic 项目,对于我数据库中的四个存储过程,它给了我一个 Sps.cs,其中包含 4 个返回 StoredProcedure 对象的方法.

I ran through the subsonic project and for the four stored procs I have in my DB, it gave me a Sps.cs with 4 methods which return a StoredProcedure object.

如果您使用 MVC,您通常使用 StoredProcedure 对象还是将其包装在您的业务逻辑周围并返回数据集、列表、集合或其他内容?

If you used a MVC, do you usually use the StoredProcedure object or wrap that around your business logic and return a dataset, list, collection or something else?

数据集仍然是常态还是被其他东西取代?

Are datasets still the norm or is that replaced by something else?

推荐答案

如果存储过程的结果与您的表具有相同的架构,您可以使用此代码(SubSonic 2.1)构建一个集合:

If the results of the stored procedure has the same schema as one of your tables, you can build a collection using this code (SubSonic 2.1):

ProductCollection coll = new ProductCollection(); coll.LoadAndCloseReader(SPs.GetProducts(1).GetReader());

更多推荐

SubSonic 和存储过程

本文发布于:2023-11-06 16:06:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564162.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:存储过程   SubSonic

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!