CSLA .NET

From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books

CodeSmith C# Templates on Codeplex

This post has 36 Replies | 8 Followers

Top 25 Contributor
Posts 177
rasupit Posted: Thu, Feb 21 2008 7:13 PM
I have just posted a preview version of new CodeSmith templates to support CSLA 3.5.  Please give it a try and I'm looking forward to your feedback (good or bad).  I currently on have EditableRoot, EditableChildList, and EditableChild.  Other templates will be comming soon.

Some notable changes from the earlier version:

Support for Linq To SQL:
Generates CRUD operations for Linq to SQL.  Support optimistic concurrency through timestamp. 

Split Base no longer supported:
The new compiler trick with partial method provide much better implementation therefore I feel like the split base method is no longer needed.  I chosed to drop the Split with base class method to reduce the complexity of the templates.

N-level deep child support:
Although I've never needed, but if anybody needs it, thanks to Linq To SQL that make it possible, the templates will support it.

So please give it a try and let me know what do you think.  Hopefully I can beat Rocky with the release Big Smile [:D]
http://www.codeplex.com/CSLAcontrib/SourceControl/ListDownloadableCommits.aspx

Ricky
Top 75 Contributor
Posts 86
Patrick replied on Thu, Feb 21 2008 8:44 PM

Very cool and good timing Ricky.

I will go and try them out Smile [:)]

Thanks,

Patrick

Top 500 Contributor
Posts 27

Ricky,

you rock :)

 

Ash

Top 150 Contributor
Posts 47
GeorgeG replied on Wed, Feb 27 2008 2:14 PM

How do we use the new 3.5 templates? Do we need to have the commercial version of CodeSmith or we can use them with the project listed here http://www.cslagenwiki.com/~cslagenw/mediawiki001/index.php?title=Main_Page

Thanks

Top 25 Contributor
Posts 177
rasupit replied on Thu, Feb 28 2008 12:24 AM
Like previous version.  This templates are built to work only with the free version of CodeSmith.  The too can be download http://www.codesmithtools.com/freeware.aspx.  However I have received feedback that the previous version would work just fine with the commercial version of CodeSmith.

Loved to hear feedback from others if they still work.


Top 150 Contributor
Posts 47
GeorgeG replied on Thu, Feb 28 2008 11:48 AM

For csla version 2.xx I am using the open source project updated lastly by Andres Villanueva. I just click on CslaGenerator.exe and then point on a db, pick a table and business object type and then generated the code. I am not familiar of how to make your templates/project work with CodeSmith 2.6. I did download the free version of CodeSmith but could not figure out how to call the 3.5 templates. Can you please summarize the process of how to make them work? Probably I need to get more familiar with codesmith itself.

Thanks

Top 25 Contributor
Posts 177
rasupit replied on Thu, Feb 28 2008 6:43 PM
I haven't have the time to update the readme file for this version.  However the readme file from previous version should probably help you as there are very little change from previous version.

You do need to be familiar on how to use CodeSmith.  Most people that use code generation usually make minor modification to suit their progamming need.

Other than the source control, you can also download the previous version here

HTH
Top 150 Contributor
Posts 47
GeorgeG replied on Fri, Feb 29 2008 3:37 PM

I am doing some progress on my end. I clicked on CodeGenTemplates\CodeSmith\CSLA35\CSharp\EditableRoot.cst
and CodeSmith launched.
Entered an ObjectName
Went to RootTable and created a new connection to our sql. From the table list I select a table.
Clicked on generate and get this error message

System.Exception: Unique Column(s) is required.
   at CodeSmith.Csla.TemplateBase.ObjectInfo.Validate()
   at CodeSmith.Csla.TemplateBase.ObjectInfo..ctor(CodeTemplate template)
   at _CodeSmith.EditableRoot_cst.__RenderMethod1(TextWriter writer, Control control)
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.Control.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToString()
   at CodeSmith.Gui.CodeTemplateGenerator.f(Object A_0, EventArgs A_1)

ResultSetIndex=0.  What am I missing?

Thanks

 

Top 10 Contributor
Posts 1,230

As I recall, a lot of template code was written assuming your tables have Primary Keys and maybe unique indexes. Does the table have a PK?

Joe

 

Top 150 Contributor
Posts 47
GeorgeG replied on Mon, Mar 3 2008 10:58 AM

You are right. I only had a unique index. After dropping the unique index and creating a primary key, the template works.

Thanks

 

Top 75 Contributor
Posts 86
Patrick replied on Sat, May 3 2008 9:51 PM
rasupit:
Hopefully I can beat Rocky with the release Big Smile [:D]

Hi Ricky,
I was just wondering how you are going with the templates for CSLA.NET 3.5? Smile [:)]
I really like the ability to generate the code from XML with your templates.

Thanks for all your effort,
Patrick
Top 500 Contributor
Posts 25
is there any chance of similar csla 3.5 templates for VB .NET coming up?
Not Ranked
Posts 3

Hello,

First thanks for the work on the templates, they're nice!Smile [:)]

One question I had concerns the updating code in the DataPortal_Update() method.  It seems that if I have a BO created and update a property, but before I submit submit the changes, another user happens to be working with the same record and submits his changes first. Won't the first change wipe out the changes from the second? 

i.e.  if the original DB record has firstname=tom and lastname=smith and user #1 changes firstname to mike, but before he submits his change, user #2 submits lastname=jones.  After user #1 submits, I would think it should be tom jones, but it seems like it will be tom smith.  Is this something that is taken care of at a different layer or should there be an error thrown or is this just a design decision?

Thanks!

Mike

 

Top 25 Contributor
Posts 177
rasupit replied on Tue, May 6 2008 8:46 PM
Patrick,
Thanks for the reminder.  I had been side tracked and turned my attention away from this.  I'll continue to work on the other stereotypes.  In the mean time... for anybody that have not already try with it.  please give it a try and keep the feedback coming.

Ricky
Top 25 Contributor
Posts 177
rasupit replied on Tue, May 6 2008 9:04 PM
pandelaras,
Like the previous version, hopefully somebody will volunteer and enhance the existing vb version.  It shouldn't be too much work.

Mike,
The answer is optimistic concurrency.   The book and sample project explain how to implement this type of concurrency to address this kind of scenario.  The template also support optimistic concurrency.
Page 1 of 3 (37 items) 1 2 3 Next > | RSS

Please contact Magenic for your .NET consulting
and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems