Newbie Question

Newbie Question

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


coss74 posted on Monday, September 04, 2006

Hi,

I am using the codesmith program to try and generate a project.

I have a client table and I wish to generate the classes to allow for Insert/Update/Delete with the client table. To achieve this i use the EditableRoot.cst. Then wanting to be able to list the clients in a datagrid i create a clients class based upon the EditableRootList.cst.

My problem is that when i past the code into vs2005 and try an compile the program i get the error stating there is no DeleteSelf, Insert, Update or Csla.Data.SafeDataReader dr converstion to int.

My Question is: Am i using the right templates? If so does anyone know wht i am doing wrong?

djjlewis replied on Tuesday, September 05, 2006

First of all I would double-check you have added a refereence to the CSLA dll in your library/BO project. Also some of the templates do not generate import statements, so you may need to add something like this at the top of your classes:

Imports System.Data.SqlClient ' if using SQL Server
Imports Csla
Imports Csla.Data

or for C#

using System.Data.SqlClient; // if using SQL Server
using Csla;
using Csla.Data;

You can also add these imports via the 'My Project' screens in vb.net, but I prefer to explicity add them as part of the class declaration.

Regards,

Dan.

mikeclimbs replied on Tuesday, September 05, 2006

You should be using editableswitchable for your root object.  

After you create the new object  Just change your editablelist to pass dr.getint32(0) and it should compile.

You could also create your own get that accepts a reader.

Good luck,  It took me a week of playing around with the templates to figure all the nuances out.

 

Mike

JTWebMan replied on Tuesday, September 05, 2006

A week wow, maybe we should see about setting up a how to use these page. I wonder if Lhotka would give us a page on his site to write up a how to.  I would love to make this easier as these templates save me weeks on new projects and could do the same for more people.

 

JT

mikeclimbs replied on Wednesday, September 06, 2006

Alot of that time was my ignorance. It took sometime to figure out which templates I needed.  I started with CSLA and the templates  at the same time.

Mike

 

Copyright (c) Marimer LLC