Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I learn CSLA.NET Fast?

Tags:

.net

csla

I'd like to learn CSLA.NET quickly. What advice do you have?

like image 335
KG Sosa Avatar asked Jan 26 '09 11:01

KG Sosa


3 Answers

I would suggest downloading the CSLA source code and the samples (especially the ProjectTracker sample) and take a look at the code. The best way for me to learn something fast is to build something.

To start writing objects, start by creating the dataportal infrastructure.

e.g. Here is a base CSLA object:

[Serializable()]
public class Widget : Csla.BusinessBase<Widget>
{
    private Widget()
    {
    }
}

The next step to creating the dataportal is to determine what a fetch may look like on your object. E.g., are you going to want to get an object based on their id, their name, their category, or some other property. Here is an example of the same object with the fetch factory method implemented:

[Serializable()]
public class Widget : Csla.BusinessBase<Widget>
{
    private Widget()
    {
    }

    public static Widget Fetch(int id)
    {
        return Csla.DataPortal.Fetch<Widget>(new Csla.SingleCriteria<Widget, int>(id));
    }
}

The next step is to create the dataportal method that the CSLA data portal will create.

[Serializable()]
public class Widget : Csla.BusinessBase<Widget>
{
    private Widget()
    {
    }

    public static Widget Fetch(int id)
    {
        return Csla.DataPortal.Fetch<Widget>(new Csla.SingleCriteria<Widget, int>(id));
    }

    private void DataPortal_Fetch(Csla.SingleCriteria<Widget, int> criteria)
    {
        // Connect to database (or use ORM) and populate the object here based on the criteria.Value which is the id value
    }
}

After this is completed, the next step would be to define your business object with properties, etc. This is where you will want to look at the samples provided and see how parent/child relationships are defined, etc.

Hope this helps you get started.

You can download the code and the samples at http://lhotka.net/cslanet/Download.aspx

like image 87
Jamie Wright Avatar answered Nov 15 '22 10:11

Jamie Wright


The answer to this question all depends on your definition of the words "learn" and "fast". In my experience, no one ever learns anything fast.

That being said I would suggest you visit Rockford Lhotka's site and check out the forums and books that are there.

http://www.lhotka.net/cslanet/
http://forums.lhotka.net/

like image 41
Andrew Hare Avatar answered Nov 15 '22 10:11

Andrew Hare


Get the book. Read the book. Start using the framework :o/

I've been working with CSLA.Net for 4 years and I'm still learning new tricks and features every week :o)

like image 43
Andrew Avatar answered Nov 15 '22 11:11

Andrew