如何快速学习 CSLA.NET?

发布于 2024-07-12 21:55:48 字数 32 浏览 4 评论 0原文

我想快速学习 CSLA.NET。 您有什么建议?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

情愿 2024-07-19 21:55:48

我建议下载 CSLA 源代码和示例(尤其是 ProjectTracker 示例)并查看代码。 对我来说快速学习东西的最好方法就是构建一些东西。

要开始编写对象,请从创建数据门户基础设施开始。

例如,这是一个基本 CSLA 对象:

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

创建数据门户的下一步是确定对象上的提取可能是什么样子。 例如,您是否想要根据对象的 id、名称、类别或其他属性来获取对象。 以下是实现了获取工厂方法的同一对象的示例:

[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));
    }
}

下一步是创建 CSLA 数据门户将创建的数据门户方法。

[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
    }
}

完成此操作后,下一步是使用属性等定义您的业务对象。您将在此处查看提供的示例并了解如何定义父/子关系等。

希望这可以帮助您入门。

您可以在 http://lhotka.net/cslanet/Download.aspx

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

烂柯人 2024-07-19 21:55:48

这个问题的答案完全取决于您对“学习”和“快速”这两个词的定义。 根据我的经验,没有人能够快速学习任何东西。

话虽这么说,我建议您访问 Rockford Lhotka 的网站并查看那里的论坛和书籍。

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

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/

榆西 2024-07-19 21:55:48

获取本书。 读了这本书。 开始使用该框架 :o/

我已经使用 CSLA.Net 4 年了,而且每周我仍然在学习新的技巧和功能 :o)

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)

浊酒尽余欢 2024-07-19 21:55:48

我强烈建议您查看我们的CSLA 3.8 模板。 它们有 VB.NET 和 C# 风格。 我们目前正在开发一个主要版本,添加 SQL 存储过程、对象工厂和多对多支持。 这是一个很好的起点,因为我们有真实世界的示例,例如 Microsoft PetShop 示例应用程序,它是通过单元测试完全生成的(业务层和数据访问层),以准确向您展示 CSLA 的工作原理。 如果您有任何疑问或遇到问题,我们将随时帮助您了解并成长为 CSLA 开发人员。

对学习 CSLA 的另一个巨大赞扬是购买以下书籍:Expert C# 2008 Business Objects

谢谢
-Blake Niemyjski(CodeSmith CSLA 模板 的作者)

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)

倒数 2024-07-19 21:55:48

我建议您阅读罗克福德的这本书,让您开始了解背后的基本原理框架以及一切如何组合在一起

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

饭团 2024-07-19 21:55:48

Magenic(Rocky 的公司)全年提供多场 CSLA 大师班,课程非常棒,会给您带来沉浸式体验。

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

久随 2024-07-19 21:55:48

我最好的建议是不要。 有许多更健壮、更可维护、性能更好并且在业界更广泛接受的数据访问架构。 NHibernate、Linq-to-Sql 和 Microsoft Entity Framework 是三个。 跟着行业走。 不要成为独行侠。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文