LINQ2SQL-存储过程不会在设计器中生成类 [英] LINQ2SQL - Stored procedure doesn't generate class in designer

查看:61
本文介绍了LINQ2SQL-存储过程不会在设计器中生成类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上是想通过设计器向我的LINQ2SQL添加一组存储过程.

I'm basically trying to add a set of stored procedures to my LINQ2SQL via the designer.

它将存储过程添加到方法面板,但不会在设计器上生成类(尽管在后面的设计器代码中会生成类.

It adds the stored procedures to the method panel but doesn't generate a class on the designer (although it does in the designer code behind.

它根据存储过程为返回类型赋予了一个奇怪的名称,基本上,我正在尝试找出将返回类型更改为更有意义的最佳方法.

It gives the return types a bizarre name based on the stored procedure and basically I'm trying to work out the best way of changing the return type to something more meaningful.

我知道我可以在设计器上手动创建类,但是我有5个非常大的类,并且想知道是否有一种方法可以自动创建这些类,或者只是正确地重命名返回类型?

I know I can manually create classes on the designer but I have 5 very large classes and wondered is there a way of creating these automatically or just renaming the return types correctly?

我找到了这个问题,但是我认为这涉及到手工编写您的课程,然后做一些改动,所以不确定:

I found this question but I think this involves writing your class by hand and then doing a bit of a hack so wasn't sure about it:

LINQ to SQL-无法修改存储过程的返回类型

推荐答案

请参见此帖子.

如果向下滚动到将SPROC方法的返回类型映射到数据模型类"部分,则可以看到,如果将存储过程拖到LINQ2SQL设计器中的特定模型类上,它将告诉设计器您希望存储过程返回该模型类型的集合.

If you scroll down to the section on "Mapping the Return Type of SPROC Methods to Data Model Classes", you can see that if you drag the Stored Procedure onto a particular model class in your LINQ2SQL designer, it will tell the designer that you want the stored procedure to return a collection of that model type.

您还可以研究人们处理存储过程中返回多种类型数据的方式,并将其作为解决问题的一种方法.

You can also look into the ways people handle returning multiple types of data from stored procedure as a method of dealing with your problem as well.

这篇关于LINQ2SQL-存储过程不会在设计器中生成类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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