CSLAGen

CSLAGen

Old forum URL: forums.lhotka.net/forums/t/3668.aspx


mr_lasseter posted on Monday, October 08, 2007

Andres,

I have been playing around with the CSLGen and been unable to get the NVL to create stored procedures or any object to create procs.  I have made sure to set Generate Procedures to true, but it still doesn't work.  Below is the code that is produced?  Am I doing something wrong?

<code>

'' This file was generated by CSLA Object Generator v1.0
''
'' Filename:    ProjectList
'' ObjectType:  ProjectList
'' CSLAType:    NameValueList
''
Imports System.Data.SqlClient
Imports CSLA
Imports CSLA.Data

Namespace MyNamespace
 
 ''' <summary>
 ''' This is a base generated class of <see cref="ProjectList" /> business object.
 ''' </summary>
   <Serializable()> _
 Partial Public Class ProjectList
  Inherits NameValueListBase(Of Int32, String)
 
#Region " Constructors "
  
  Protected Sub New()
   ' Prevent direct creation
  End Sub
  
#End Region
  
#Region " Shared Methods "
 
 Private Shared m_CachedResults As New Dictionary(Of Object, ProjectList)
 Public Shared Sub Invalidate()
  m_CachedResults.Clear()
 End Sub

#End Region
  
  
#Region " Authorization "


  Public Shared Function CanGetObject() As Boolean
   Return True
  End Function
  
#End Region

#Region " Data Access "
  
 
 Private Sub LoadCollection(ByVal cmd As SqlCommand)
  RaiseListChangedEvents = False
  Using dr As New SafeDataReader(cmd.ExecuteReader())
   IsReadOnly = False
   While dr.Read()
    dim nvp As New NameValuePair( _
     dr.GetInt32("ProjectId"), _
     dr.GetString("ProjectName"))
    Me.Add(nvp)
   End While
   IsReadOnly = True
  End Using
  RaiseListChangedEvents = True
 End Sub
 
#End Region

  
#Region " Events "

#End Region
 End Class
 
End Namespace

</code>

xal replied on Monday, October 08, 2007

Stored procedures for delete and fetch are generated based on the criteria object.
Notice that the generated code doesn't have a factory method or a dataportal method either.

You must create a criteria object and set Factory, DataPortal and Procedure to true inside "Get options" (for that criteria object) in order to get all that generated.

BTW, you'll have more luck posting these kind of questions in CslaGenerator's forum. ;)

Andrés

Copyright (c) Marimer LLC