Newbie: Completely Lost

Newbie: Completely Lost

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


toddc posted on Tuesday, May 15, 2007

I'm referencing CSLA 2.0 for the moment.

I'm using CodeSmith 4.0 and the CSLA template to build ReadOnly classes.

The problem is this Code Smith 4.0 generated code:

Using cn As SqlConnection = New SqlConnection(Database.VELIVEconnection)

Indicated by the error: Name 'Database' is not declared

How do I fix this in my classes? I really want the connection string to come from settings(I think).

I'm new to VB and the CSLA. I've read Expert VB 2005 Business Objects and love the concepts. But my understanding of VB and CSLA is like swiss cheese. I have huge holes everywhere.

The above error is the only one I have in my library class but of course many times in each class.

Any help to understand this issue is sincerely appreciated.

Todd

david.wendelken replied on Tuesday, May 15, 2007

I'm not using the templates yet, so this is just a guess.

I guess that you are expected to write the Database class by hand, and that that class should be public and static, and that it should have a public static property in it that returns the correct connection string, with a name of VELIVEconnection.

I'm also guessing that somewhere in the generation process you supplied the value "VELIVEconnection" (or it defaulted to it and you didn't notice :), and that you would be expected to supply additional properties for each database connection you intend to use.

Let us know if that's it!

david.wendelken replied on Tuesday, May 15, 2007

forgot to add, there is a whole csla forum devoted to the templates.

you need to go to the forum home and work your way down from there.

Copyright (c) Marimer LLC