in

CodeSmith Community

Your Code. Your Way. Faster!

Change the template

Last post 05-16-2008 4:10 AM by olemansfeld@gmail.com. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-16-2008 2:46 AM

    Change the template

    Hi fellow nettier builders

    I would like to change the template generating the stored procedures. Like the automatic check on timestamp columns i would like to implement that if a table has a column Active:bit then this should be included in the where sentence for Get methods.

     Any suggestions to fix this thing is most welcome much appriciated.

    Thanks!

    Ole

    • Post Points: 5
  • 05-16-2008 4:10 AM In reply to

    Re: Change the template

    Answer

    Found the solution

    In file Dataaccesslayer.sqlclient/StoredProceduresXml.cst

    I've added to the if (IncludeGetList) section:

    <%if (ActiveCol != null){%>
        WHERE
         Active = 1
        <%}%>

    And above in the

    // Holds the ActiveCol column if there's any
      ColumnSchema ActiveCol = null;

    foreach (ColumnSchema column in cols)
      {
       if ( ! IsIdentityColumn(column) && ! IsComputed(column) )
        colsUpdatable.Add(column);
        
       if (column.NativeType.ToLower() == "timestamp")
        RowVersion = column;
        
       if (column.Name.ToLower() == "active" && column.NativeType.ToLower() == "bit")
        ActiveCol = column;

      }

    • Post Points: 5
Page 1 of 1 (2 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems