Subsonic 3.0.0.3不为存储过程生成参数

Mik*_*nis 8 subsonic templates stored-procedures subsonic3

我有一个带有一堆存储过程的SQL Server 2008数据库.当我使用Subsonic 3.0.0.3提供的ActiveRecord模板时,它会为我的所有存储过程生成方法,但它们没有任何参数.我是服务器上的dbo,可以执行存储过程,而没有来自Management studio的问题.

示例存储过程

CREATE PROCEDURE [dbo].[prc_Sample]
    @FileName   VARCHAR(50)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    IF EXISTS ( SELECT * FROM Sample WHERE FileName = @FileName )
    BEGIN
        RETURN -1
    END

    RETURN 0

END
Run Code Online (Sandbox Code Playgroud)

样本生成方法

public StoredProcedure prc_Sample(){
    StoredProcedure sp=new StoredProcedure("prc_Sample",this.Provider);
    return sp;
}
Run Code Online (Sandbox Code Playgroud)

如果我检查SQLServer.ttinclude,我可以看到所有获取存储过程的方法都存在,但由于某种原因它们没有生成.这不是存储过程名称中有下划线的问题 - 这可以在有和没有下划线的情况下被破坏.

任何想法或任何人都知道如何调试模板文件?

Kon*_*Kon 13

我有同样的问题,我不得不调整它SQLServer.ttinclude以使其工作.在该文件中找到GetSPParams()方法并更改一行:

string[] restrictions = new string[4] { DatabaseName, null, spName, null };
Run Code Online (Sandbox Code Playgroud)

string[] restrictions = new string[3] { null, null, spName };
Run Code Online (Sandbox Code Playgroud)

.

BlackMael的答案有一个有用的链接,帮助我弄清楚如何调试和单步执行模板代码.

现在我还不能100%确定我的改变是好的(可能会有一些不利影响).我只是没有机会彻底测试它,需要阅读更多内容,Restrictions因为它们与GetSchema()方法有关.但是现在,这解决了我的问题,我可以成功传入我的存储过程参数.

更新:这可能与我的DB文件嵌入App_Data中的VS solutin这一事实有关.使用独立的SQL Server实例时,这可能会更好地开箱即用.