Hi everyone I just registered so I’m very new to the CSLA forum ,so please bear with me if I ask stupid questions!
A few days ago I came across CSLA and was amazed with what it can do looks like a great and very robust framework to base web and winforms applications on.
I am currently using "My generation" see www.mygenerationsoftware.com/ to generated O/R code using doodas as my dataacess which i find very limiting. So i moved over to CSLA a few days ago.
My question is i can’t seem to find a template for CSLA 1.0 or CSLA 2.0? if none exsits what the best approached to follow when building a template
Also is it possible to use CSLA framework with a mysql 5.0 database?
Thanks in advance.
Oops looks like i missed that folder in the zip,
>>A few days ago I came across CSLA and was amazed with what it can do looks like a great and very robust framework to base web and winforms applications on.<<
>> I am currently using "My generation" see www.mygenerationsoftware.com/ to generated O/R code using doodas as my dataacess which i find very limiting. So i moved over to CSLA a few days ago. My question is i can’t seem to find a template for CSLA 1.0 or CSLA 2.0? <<
If you use C#, pay particular attention to a post you are likely to see here later today from Guy Roche. He's been working on his C# CSLA 2.0 template for a while. He was kind enough to act a mentor for my introduction to MyGeneration and can proably offer some specific guidance for that language. If you prefer VB.NET, I'm not sure where to send you. I have some templates for CSLA 1.5.2 (well, really, 1.3 because they still generate the older BrokenRules handling techniques). I have templates for ERO, ECO, ECC and ROC (as well as some short ones for stored procedures and even one for the BindField routine (yeah, I'm pretty lazy <g>). I haven't heard of anyone else doing 1.x templates in C# or 2.x templates in VB - which is a real shame. I think the power of the metadata in MyGeneration (and the ability to write your templates in C# or VB rather than a scripting language) makes it more attractive than CodeSmith. Obviously, this is a matter of opinion. But I'm surprised there isn't a bigger MyGeneration community here, yet. FYI, CodeSmith was chosen by the early CodeGen adopters here on the forum and most of us used the results of their excellent efforst in getting started with CodeGen. Perhaps many just never saw a big enough benefit to make the change.
>> if none exsits what the best approached to follow when building a template <<
This is a great question and should probably spark a new thread of its own. It might be best if it were to take place (or at least be mirrored) at the MyGeneration Forum. You really want to define your use case(s), just like developing any other project, I believe. I have seen some models which try and build a template to do almost everything, so that you simply make your object type selection in the UI and the template can generate EROs, ECOs, and ECCs. My own strategy is to have separate templates for each CSLA business object type (although I obviously haven't finished them all yet). My template writing strategy is basically
(1) treat the Render() method just like an old mainline routine - it just makes calls to the routines that print respective Regions of the object's code passing the table object (and, implicitly, the MetaData you defined for it), e.g., WriteMemVars(oTable) and WriteValidation(oTable). For DataAccess, I use a DataAccess main routine that calls separate ones for dp_Create, dp_Update, etc.
(2) include a Utilities Region (or separate template you Include when running) for such things as writing the Region and End Region statements, generating default values for properties based on type, creating property names from field aliases (if necessary) per your naming conventions, building parameter declarations and key field lists, etc.
(3) your choices for handling naming of ID fields will influence your use of metadata, but at a minimum will will want an ERO to know the names of its child objects and child collection objects (I have comma-delimited string, table-level metadata items for those) and you will want the Child and ChildCollection objects to know some information about their parent in order to generate their choreography for the 'Update dance' (i.e., you may pass the parent object reference or the parent's ID property value, for example).
(4) clearly the implementation of each region is predicated on the region and the BO type for which you are generating. You'll know this from reading the book and/or using the helpful reference I offer below.
>>Also is it possible to use CSLA framework with a mysql 5.0 database? <<
This is the question what prompted me to make sure you buy a copy of the book in answer to the first question. If you read it, it will be very clear to you that you can code your DataPortal_xxx methods to work with any data persistence strategy you wish. You can run a search here (or on the older site you'll see referenced on our home page here) for MySql and you should be able to get some information about folks using it. Then if you still have questions, start a new thread for it; it should likely attract just the kind of responders you need.
Reading the book is essential here. You don't have to focus enough to be able to write the framework yourself, but it sure helps to get the OO design and BO implementation chapters down cold. Obviously the chapter(s) on the UI of your choice will also be valuable (though you need not subscribe to his implied paradigm for UI presentation technique - always using a separate list screen from which the user picks an object for editing).
As far as a target design for you BO code, check out www.onelittlevictory.com if you haven't found it yet. You'll find it a godsend as a new CSLA'er. He's got paste-able code there that you can use as the model for what your templates should generate, which should be a pretty big time savings for you - they sure were for me. But do yourself a favor and read the book first!! (And once you have, if you're interested in the 1.x templates, send me a private msg and I'll send them along.)
Welcome to the CSLA community!
Quick correction to my post.
I just saw in a remark by Rocky on another thread the current 2.x version is 2.0.2.
I'm a HUGE fan of MyGeneration too. Unfortunalty I'm away until July 24th (at least) and won't be able to help you before then.
CSLA and MyGeneration works just fine as a team.
Q Johnson Thank you for your lengthly response much apreciated!!!
I justed ordered the Expert C# 2005 Business Objects 2nd Edition 2006 as you suggested.
And to everybody else thanks for reply’s as well !
Hi, check this out
Patrick,
Those CSLA templates you referenced are actually just ports of the original CodeSmith work done here. They even use CodeSmith's SchemaExplorer rather than MyMeta. You may have noticed that the author even makes a powerful suggestion that this is the case by the username s/he chose when posting them there for your use: KoadSmith.
You may enjoy some benefit of working with them in MyGeneration. But I think you are missing the real power of MyGeneration by using it in this fashion.
I suspect there are two types of CodeGen users here. One group is ready to climb the learning curve and enjoy all the power of the product they choose. They'll have project-specific templates and be able to re-generate a whole project through a single process using the features of the tool they choose. They have an "active code generation" strategy. To my mind, MyGeneration offers the best capabilities for that time investment. (I really appreciate the ability to write the templates in Visual Studio and to use VB rather than the scripting language.) Obviously, rational minds can disagree on this. Folks who already have mastered scripting syntax may just love CodeSmith.
The second group is made up of folks who want to learn as little as possible and just get some code generated to start their project. They are happy enough with a "passive code generation" strategy (generate once and make manual modifications for ever more - no REgeneration). They get some benefit for some effort. I belive that for CSLA'ers, at this point at least, that the CSLA templates availble for CodeSmith are more mature and therefore safer for the intended use of this ssecond group. But I would certainly recommend running them in CodeSmith. If you're looking for the least effort, that certainly seems to be the path.
But if you are in that first group and want the most power, well... you have to look pretty carefully at both products, make your choice, and then climb that learning curve. I'm very happy to have made the MyGeneration choice; your mileage may vary.
By the way, it really isn't a two-product market, of course. And if you are looking into the CodeGen subject as a member of a programming team of, say, five or more members, I strongly suggest you take a look at Kathleen Dollard's book: Code Generation in Microsoft.NET. Her generation harness is extremely powerful - and is also free for the price of the book (like CSLA). But its complexity (agin, in my mind at least) puts it out of the range of a casual user. But if you are working with it every week for several hours (as you would if you were the CodeGen guy for an organization with several programmers), you could easily "stay up to speed" with it. The learning curve is steeper than that for either CodeSmith or MyGeneration, but the benefits are greater, as well.
I think that if you have so much code generation work to do that your technical time is half coding and half code-generation-template-creation-and-maintenance, you are doing enough of it to justify her techniques. But I just don't belive that many small shops (one and two-person teams especially) have anyone who spends this much time on generation issues. They are consumed with enough other developer tasks that code generation is probably less than 20% of their time. So I don't think they would get as much reward for their effort with Dollard's ideas and harness as they would with the "easier" tools (because they would be climbing the learning curve over and over again).
But I would welcome the analysis of others on these issues! These are just my private observations after looking at these three offerings (and very briefly at several others that were easy to reject).
Copyright (c) Marimer LLC