实施 C# 业务对象 (CSLA)
我们即将致力于实施 Rocky Lhotka 的 CSLA 作为我们 Visual Studio 2008 解决方案的应用程序开发框架。我想在 SO 上进行测试,并且特别感兴趣的是开发人员对该方法与其他 ORM(例如实体框架或 nHibernate)进行比较的意见。
另外,学习曲线是什么样的?维护按照这种方法编写的应用程序是否容易(正如我听说的那样)?
我们也非常有兴趣听取任何已实施此计划的公共部门(特别是政府机构)的意见。
谢谢,
马斯
We are about to commit to implementing Rocky Lhotka's CSLA as an application development Framework for our Visual Studio 2008 solutions. I would like to test the water on SO and am particularly interested in developer's opinions of the approach in comparison with other ORMs such as Entity Framework or nHibernate.
Also, what is the learning curve like and is it as easy (as I have heard) to maintain the applications written to this methodology?
Also would be very interested to hear from any Public Sector (especially Government Agencies) who have implemented this.
Thanks,
MaS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
CSLA 不是 ORM 框架。它是实现业务对象的框架。但是,有一些代码生成器可以为您生成数据访问代码。 CSLA 框架基于 Active Record 模式。这种模式不适用于大型项目。在我看来,你应该实现一个原型。原型的目标应该是:
如果您的评估似乎对上述项目是积极的,那么就去它。简而言之,使用这样的框架应该有适当的理由。你不应该听从别人的建议,而应该自己尝试。
CSLA is not an ORM framework. It is a framework for implementing business objects. However, there are code generators available which can generate data access code for you. The CSLA framework is based on Active Record Pattern. This pattern will not scale for large scale project. In my opinion, you should implement a prototype. The goal of the prototype should be to:
If your evaluation seems to be positive against the above items, then go for it. In short, there should be a proper justification for using such a framework. You should not go with some one's advice, rather try it out by your own.
CSLA 的学习曲线还不错,但要准备好花一些时间阅读本书。我们通过为您生成 DAL(参数化 SQL 或存储过程支持)来解决您的大部分学习曲线,因此它为 CSLA 添加了 ORM 感觉,只是因为如果您选择的话,它会为您管理 DAL。但您完全可以将其用作一组 BO 模板。我发现活跃生成使升级到较新版本的 CSLA 以及添加功能变得更加容易,而无需强烈需要中间类。
谢谢
-Blake Niemyjski(CodeSmith CSLA 模板 的作者)
The learning curve of CSLA isn't too bad but be prepared to spend some time reading in the book. We have taken care of a lot of the learning curve for you by generating a DAL (Parameterized SQL or Stored Procedure support) for you, so it adds an ORM feel to CSLA only because it manages the DAL for you if you choose. But you can completely use it as just a set of BO templates. I find that active generation makes it much easier to upgrade to newer versions of CSLA as well as add functionality without having a strong need for an intermediate class.
Thanks
-Blake Niemyjski (Author of the CodeSmith CSLA Templates)
我喜欢 CSLA。
我用它来实现一些 ASP.NET 2.0 应用程序,其中一些非常大。它很容易理解(在了解 Root、Child 和 Switchable 对象之后),但您将严重依赖代码生成(如 CodeSmith)。
主要问题是:您需要 CSLA 吗?您喜欢什么功能,或者您只需要使用一些 ORM?今天,我正在使用 ADO.NET Entity Framework 编写新应用程序,它比 CSLA 更加高效。
请记住,CSLA 不是一种方法,而只是一种工具:您需要理解它并在适当的时候调整它。
I love CSLA.
I used it to implement some ASP.NET 2.0 applications, some very large. It's easy to understand (after you understand Root, Child and Switchable objects), but you'll rely heavily on code generation (like CodeSmith).
Main question is: do you need CSLA? What feature do you like, or you just need to use some ORM? Today, I'm writing new applications with ADO.NET Entity Framework and it's more productive than CSLA.
Keep in mind CSLA isn't a metodology, but just a tool: you'll need to understand it and to tweak it when appropriate.
CSLA 是一个业务对象框架。处理数据访问的策略有很多 - ORM 和数据访问之间有很多重叠。我在数据访问层中使用 Linq-to-SQL 来简化开发取得了很大的成功。我认为这是一种适合您的方法 - 特别是考虑到(根据您的评论)您需要支持 SQL Server 和 Oracle。
Rocky 的书和 www.lhotka.net 上的示例中详细记录了使用单独的 DAL。
至于 TFS,它是用于源代码控制、项目管理和构建自动化的 ALM 工具。您可能希望将 CSLA 源代码像任何其他代码一样置于源代码控制之下。最简单的方法是将 CSLA 包含在您的解决方案中。
另一种方法是单独编译它并在项目中使用对 CSLA.DLL 的文件引用。在 TFS 自动构建中,有一个属性组,您可以在构建服务器上放置该 DLL 的路径。
最后,Rocky 在他的网站 http://download.lhotka.net/ 上出售 CSLA 培训视频default.aspx?t=Core38
CSLA is a business object framework. There are many strategies for dealing with Data access - there is much overlap between ORM and data-access. I have had a lot of success using Linq-to-SQL in a Data Access Layer to simplify development. I think this is an approach that will work for you - especially given (based on your comments) your need to support both SQL Server and Oracle.
Using a seperate DAL is well documented in Rocky's book and samples on www.lhotka.net
As far as TFS - it's an ALM tool for Source Control, Project Managment and Build Automation. You would want to put the CSLA Source under source control like any other code. The simplest approach would be to include CSLA in your solution.
Another approach would be to compile it seperately and use a file reference in your projects to the CSLA.DLL. In TFS Automated build there is a property group which you could put the path to that DLL on your build server.
Lastly Rocky sells CSLA training videos on his website at http://download.lhotka.net/default.aspx?t=Core38
您可以在以下广播中查看 Rocky 对 SOA 的想法:
http://www.slickthought.net/post/Minneapolis-Developer-Roundtable-Podcast---Talking-REST.aspx
您需要掌握的主要内容是 CSLA 是一个业务框架。尽管 ORM 可以为您提供基本的验证(和其他)功能,但恕我直言,它们并不能真正弥补可靠业务层的缺乏。您当然可以将 ORM 与 CSLA 结合使用(我相信 CSLA 示例中有一个使用 EF 的示例,并且 CSLA Contrib 项目中使用 NHibernate 作为示例),但这些技术只是互补的。
学习曲线……这取决于你。我发现它很容易上手。我认为如果你对面向对象有很好的掌握,你应该很快就能得到一些基本的东西并运行起来。最近发布的视频也非常适合您入门。
You can check Rocky's thoughts on SOA in the following broadcast:
http://www.slickthought.net/post/Minneapolis-Developer-Roundtable-Podcast---Talking-REST.aspx
The main thing you will need to grasp is that CSLA is a Business framework. Even though ORMs can give you basic validation (and other) features they do not IMHO really compensate for the lack of a solid business layer. You can of course use an ORM with CSLA (there is an example of using EF in the CSLA examples and NHibernate is used as an example in the CSLA Contrib project I believe) but the technologies are just complimentary.
The learning curve... well that depends on you. I found it quite easy to get started with. i think if you have a good grasp of OO you should be fine to get something basic up and running soon. The recent videos released are also very good to get yuo started.