From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books
Very cool and good timing Ricky.
I will go and try them out
Thanks,
Patrick
Ricky,
you rock :)
Ash
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
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.
I am doing some progress on my end. I clicked on CodeGenTemplates\CodeSmith\CSLA35\CSharp\EditableRoot.cstand CodeSmith launched.Entered an ObjectNameWent 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?
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
You are right. I only had a unique index. After dropping the unique index and creating a primary key, the template works.
rasupit:Hopefully I can beat Rocky with the release
Hello,
First thanks for the work on the templates, they're nice!
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