1

IMultipleResult我有一个用于返回在部分类中实现的存储过程的 LINQ to SQL 接线代码。

当您在dbml文件中添加新对象时,会再次生成存储过程接线代码;这会导致代码在我的部分类和designer.cs.

如何标记存储过程,使dbml设计器中的更改不会自动生成接线代码?

namespace Audit
{
    public partial class LinqAuditDataContext 
    {
        [Function(Name = "getRows")]
        [ResultType(typeof(featuresE))]
        [ResultType(typeof(featuresWater))]
        [ResultType(typeof(featuresV))]
        public IMultipleResults getRows([global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "Int")] System.Nullable<int> page, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "Int")] System.Nullable<int> rowsshow, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "NVarChar(30)")] string table, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "Bit")] System.Nullable<bool> fact, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType = "Int")] System.Nullable<int> id_obj)
        {
            IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), page, rowsshow, table, fact, id_obj);
            return ((IMultipleResults)(result.ReturnValue));
        }


    }
}
4

1 回答 1

0

我删除了 dbml 文件中的 getrows 并在部分类的不同文件中定义。它有效......也许有一个想法?

部分 LinqAuditDataContext 中的函数

public partial class LinqAuditDataContext 
    {
        [Function(Name = "getRows")]
        [ResultType(typeof(featuresE))]
        [ResultType(typeof(featuresWater))]
        [ResultType(typeof(featuresV))]
        public   IMultipleResults getRows(System.Nullable<int> page,  System.Nullable<int> rowsshow, 
            string table, System.Nullable<bool> fact, 
            System.Nullable<int> id_obj, bool t)
        {
            IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), page, rowsshow, table, fact, id_obj);
            return ((IMultipleResults)(result.ReturnValue));
        }


    }
于 2012-10-18T03:48:38.733 回答