C# Templates to support CSLA 2.1

C# Templates to support CSLA 2.1

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


rasupit posted on Thursday, September 21, 2006

I have just checked in a new version on Source Code in CSLA Contrib (6445).  These templates contain enhancement to support CSLA 2.1.  I also added "write first wins" concurrency support when timestamp field is detected.

Download is available at:  http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=CSLAcontrib

Ricky

Sarosh replied on Friday, September 22, 2006

Hi!

The download does not seem to work.

It starts downloading the Zip file but then nothing happens.

Sarosh

Skafa replied on Friday, September 22, 2006

Do the templates still work for CSLA 2.0?

And is there some option to not use fww concurrency? I use timestamp fields, but not for 'first write wins' concurrency.

thanks,

Remco

AaronEngel replied on Tuesday, October 03, 2006

I successfully downloaded the updates.  When I extract the files, they are extracted to <myLocation>\CSLAcontrib\CodeGenTemplates\CodeSmith\CSLA20, and the template comments indicate that these templates were "generated using CSLA 2.0 CodeSmith Template Collection".  These may be minor issues that should not affect the resulting code, but I am seeing other issues as well with 2.1.

 I am using the new CSLA2.1 RTM, and when I attempt to load an object I get the following error:

Csla.DataPortalException: DataPortal.Create failed (System.NotSupportedException: Invalid operation - create not allowed at Csla.Core.BusinessBase.DataPortal_Create()) ---> Csla.Server.CallMethodException: DataPortal_Create method call failed ---> System.NotSupportedException: Invalid operation - create not allowed at Csla.Core.BusinessBase.DataPortal_Create()

If I change the generated factory "new" method from

Public Shared Function NewCustomer() As Customer

   Return DataPortal.Create(Of Customer)()

End Function

To:

Public Shared Function NewCustomer() As Customer

      Return DataPortal.Create(Of Customer)(New Criteria(Guid.NewGuid))

End Function

The object works.  I believe the factory new method changed as a part of 2.1, and it may have changed since the templates were last updated.

 

Thanks!

 

rasupit replied on Tuesday, October 03, 2006

AaronEngel,

The code that you have posted is vb code, I'm pretty sure it did not get generated from c# templates. Smile [:)]

I suggest you to contact the author or create a new thread regarding this issue.  I'm afraid that your post on this thread may not raise attention from the author.

Ricky

Michael Hildner replied on Wednesday, October 04, 2006

rasupit:
The code that you have posted is vb code, I'm pretty sure it did not get generated from c# templates.

Ricky, I downloaded from your link and there's some VB stuff in there under CSLAcontrib\CodeGenTemplates\CodeSmith\CSLA20\VB

Maybe that's what AaronEngel is referring to?

Thanks for the templates!

Mike

AaronEngel replied on Wednesday, October 04, 2006

Yes, that is what I am referrring to.  The download link contains VB templates as well.  Perhaps these templates have not been updated for 2.1?

AaronEngel replied on Wednesday, October 04, 2006

Will the templates for 2.1 soon show up under the releases tab on this site?

rasupit replied on Wednesday, October 04, 2006

Is available.  Here is the link http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=CSLAcontrib

I also change the link on the top of the thread.

Ricky

david.wendelken replied on Thursday, October 12, 2006

Thanks for all your good work on this!   And - thanks for letting CodeSmith add these templates directly to the next release of their product.

I'm trying to add some features to the templates (I'll contribute the changes when done), but I'm new to CodeSmith.  I have 3.2 professional.  I made a change to the Template.cs file and saved it, but the changes don't show up in the generated code.  What do I have to do to get it to recompile?  

rasupit replied on Friday, October 13, 2006

David,
I don't use CodeSmith 3.2 ide, so I may not be able to help you using the ide.  However, from property screen, clicking the second icon from left on the toolbar will recompile the template.  Otherway is to close and reopen the template.

HTH,
Ricky

david.wendelken replied on Friday, October 13, 2006

Found the problem.  Me being stupid. :)

Did find this link, however, which might help those who actually do have the problem I thought I had...

http://community.codesmithtools.com/forums/thread/9450.aspx

"One minor annoyance if you are working on your base template class. Codesmith seems to have a tendency to get an out-of date version stuck in its template cache here: \Documents and Settings\All Users\Application Data\CodeSmith\v3.2\Template Cache"

I've got the first cut done on the extension that adds in comments that describe the individual properties.  Have to test it with xml input files, views, stored procs instead of tables to see how it handles things.

Copyright (c) Marimer LLC