How can I learn CSLA.NET Fast?

◇◆丶佛笑我妖孽 提交于 2019-12-03 14:31:39

问题


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


回答1:


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/




回答2:


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




回答3:


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)




回答4:


I would highly recommend checking out our CSLA 3.8 templates. They come in both a VB.NET and a C# flavor. We are currently working on a major release that adds SQL Stored Procedure, Object Factory and Many-to-Many support. It is a great starting point because we have real world examples like the Microsoft PetShop Sample application that is completely generated (both the business layers and data access layers ) with unit tests to show you exactly how CSLA works. If you have any questions or run into issues we are here to help you understand and grow as a CSLA developer.

Another great compliment to learning CSLA is purchasing the following book: Expert C# 2008 Business Objects.

Thanks -Blake Niemyjski (Author of the CodeSmith CSLA Templates)




回答5:


I would suggest you read this book from Rockford to get you started understanding the rationale behind the framework and how everything fits together




回答6:


Magenic (Rocky's company) offers several CSLA master Classes throughout the year which are excellent and will give you an immersion experience.




回答7:


My best suggestion is don't. There are many data access architectures that are more robust, more maintainable, better performing, and more widely accepted in the industry. NHibernate, Linq-to-Sql, and Microsoft Entity Framework are three. Go with the industry. Don't be the lone ranger.



来源:https://stackoverflow.com/questions/479497/how-can-i-learn-csla-net-fast

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!