Anyone else trying to use Codesmith 2.6.0, CSLA 2.0 templates and SQLServer Express 2005?

Anyone else trying to use Codesmith 2.6.0, CSLA 2.0 templates and SQLServer Express 2005?

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


Paul Hectors posted on Monday, May 29, 2006

I am using VS2005 C# Express edition and SQLServer2005 Express edition.

I would like to use a code generator with CSLA 2.0 framework and it would seem my only option at the moment is to use Codesmith 2.6.0 freeware version and the CSLA 2.0 templates.

I am unable to get the Codesmith generator to connect to an SQLServer Express 2005 database?
Has anyone else experienced the same problem?

If anyone knows of a better solution to use code generation in C# for CSLA I would love to hear it?

The CSLA framework looks awesome but a lot of redundant work without a code generator.

Thank you for your time.

Best regards,

Paul Hectors


bnair replied on Monday, May 29, 2006

I am using Codesmith 2.6.0 and the templates that I downloaded from gotdonet.com to build my BO's and I am not having any problem.

--bnair

Paul Hectors replied on Tuesday, May 30, 2006

Hi bnair,

I was a little short in my previous post so below is what I am trying to do.

Are you using codesmith to connect to the database? Because that is where I am having one of my problems, I am unable to create a connection statement that successfully connects to the SQLServer 2005 Express  database.


Thank you for your time.

Best regards,

Paul Hectors

HectorSosaJr replied on Tuesday, May 30, 2006

Paul,

The connection string for SQLServer Express 2005 looks something like this:

data source=HECTOR\SQLEXPRESS; initial catalog=mydatabase; user id=myuser; password=mypassword;"

Express is running as an instance instead of the regular way we are used to. So remember to use your machine name then add \SQLEXPRESS, that should get you working.

- Hector

PS. Interesting last name ;)

Paul Hectors replied on Thursday, June 01, 2006

Hi Hector,

Thanks for your reply.

I got it working :-)
(I did change "user id" to "user")

Regarding my surname it originates from the border of Holland and Belgium in the mid 1600's, no earlier records have been found.

Best regards,

Paul Hectors


bobhagan replied on Saturday, June 10, 2006

I'm not sure about 2.6, but this works with 3.2.

Server=BOBS\SQLEXPRESS;AttachDbFilename=E:\Inetpub\wwwroot\ProjectTracker20cs\PTracker.mdf;Database=PTracker;Trusted_Connection=Yes;
HTH

Bob Hagan

lumberw replied on Saturday, June 10, 2006

Template 0.93 runs well in Codesmith 3.2 Explorer, but in Studio, there is error, said:

 

Path must be a valid file.

An error of type "ArgumentException" occured while attempting to execute this template.  To enable Just-In-Time debugging on this template set the "Debug" attribute to "True" in the "CodeTemplate" directive and add a "Debugger.Break()" statement in the template.

laineboe replied on Sunday, June 11, 2006

Hi,

I ran into the same problem.  Csla.cst relies on other templates and is having trouble finding them.

I solved the problem as follows:

In Csla.cst, change

 string templateName = objectType.ToString() + ".cst"; 

to

 string templateName = this.CodeTemplateInfo.DirectoryName + objectType.ToString() + ".cst"; 

Hope this helps

Laine

rasupit replied on Sunday, June 11, 2006

Laine,

That actually what I suggested and posted the changes when Sankar74 posted the error message at http://workspaces.gotdotnet.com/cslacstemplate 

Thanks for the feedback and your suggested solution. And also is good to hear that these templates will also work with CodeSmith 3.2.

BTW,  GotDotNet really sucks.  I've been getting errors when trying to access the Source Control.  Finally I was able to access it last night, but all my check ins on Source Control and replies on Message Board was not under Sankar74.  Go figure....

Ricky

Paul Hectors replied on Monday, May 29, 2006

Thank you for your reply.

Could you please let me know what your database connection string is?

Best regards,

Paul Hectors

Copyright (c) Marimer LLC