I vote for #2.
Keep Project Tracker open so you can refer to it, but try to create a small app from scratch to learn the framework. It is well worth the effort.
I agree that trying to learn "everything" at once is overwhelming - I tried it 4 years ago and it almost killed me. <g>
Tips:
1. Create a class that inherits from each CSLA and store that in a special folder. This is known as the Intermediate Base Class. e.g. CSLA has BusinessBase so you will create MyBusinessBase which inherits BusinessBase. (See older threads for the exact syntax - it can be convoluted with Generics.)
Do this even if you have no code to add. (Later on you *will* need to add code and you will thank your lucky stars you created this intermeidate class because the new code will work for all of your BOs.)
2. When you write the code for your Root BO use 2 classes. The first class will always inherit from one of the intermediate base classes above. So if you have an Account class the first will will be called AcctBase and will inherit from MyBusinessBase. The 2nd will be called Account and will Inherit from AccountBase. (Alternatively you could use Partial classes to accomplish this but they have their own set of quirks which I am not overly familiar with.)
Put as much code as you can in AcctBase. This is where a Code Generator will add all of its output. The idea is that you should be able to re-generate the Base level class and not lose any hand coded changes. So by building both classes by hand, you will learn how difficult it is to set up all the regions and other standard areas for a BO. Then you will get Codesmith and have it do all that work for you in 2 seconds.
In the Account class you should basically have no code. As a learning exercise you can add a field and Property to the Account class which returns the full name of the user who entered the Account record. This means that your code will need to access a different table (a Users table) and take the ID from the Account field and use it to get the full name. This is where you will learn that Overriding DataPortal_Fetch and calling MyBase.DataPortalFetch is very useful. You hand coded Bo only has a couplf of lines of code to return the Base set of data for the Account and then you can write 1-2 more lines to get the full name of the user and populate your "borrowed field".
I split out the DP_Fetch into a few subroutines like FetchData, FetchChildren, PostFetch. Then I only need to override a speciifc sub instead of the whole DP.
That should get you started.
Good luck.
Joe
Hi
I hope you guys don't mind me sticking my nose in on this discussion.
I'm also wanting to learn about "how to implement CSLA best practices".
Would anyone be able to post a small code example? "A sample is wirth a 1000 words"
:)
Cheers
Ozi
Thanks glenntoy
I've done a couple of csla apps, so far, and I seem to be ok with it. I'm just looking for a better structure than the Ptracker, either something like that described above or partial classes.
Cheers
Ozi
Copyright (c) Marimer LLC