您的位置:首页 > 其它

S#ARP教程第一篇:介绍和准备工作

2009-09-27 16:16 218 查看
1.SharpArchitecture是什么?
它是一个帮你快速构建MVC+NHibernate框架的平台,最有利的帮你减少代码(解耦)和提高产品质量。S#ARP架构坚持以下原则:

•专注于域驱动设计
•松耦合
•轻松搭建项目
•全部开源

总体目标是,为开发者节约编码时间,把主要精力集中在业务逻辑上。
官网地址:http://www.sharparchitecture.net/
最新1.0_RTM_build_486版本下载地址:http://www.sharparchitecture.net/downloads.htm
2.SharpArchitecture工作原理(见下图)





从图不难看出S#arp主要由四层组成,
Data 数据层(NHibernate)
Core 实体层(即MVC中的M)
Controllers 业务层(即MVC中的C)
Web表现层(即MVC中的V)
当然项目中还包含了Test和ApplicationServices(主要处理复杂业务以及跨平台,可以是Web Services、WCF。。。)
3.S#ARP框架4个辅助工具
a:T4Toolbox(http://www.codeplex.com/t4toolbox) 该框架提供了一个模板文件,其中自动帮你构建项目,而其中用的就是T4生成工具
下图就是生成的项目目录:

/MyProject – Contains MyProject.sln.
/app - Contains the core project layers.
/MyProject.ApplicationServices
/MyProject.Core
/MyProject.Data
/MyProject.Web
/MyProject.Web.Controllers
/build - Empty folder for housing build related stuff.
/lib - Contains the solution items for the deployable application.
/db - Contains database schema information; e.g., the result of scaffolding and/or NHibernate's schema export.
/docs - Project documents.
/logs - Output location for log files.
/tests
/MyProject.Tests
/tools
/lib - Contains the solution items for the tests project and all other non-deployable assemblies.
/CrudScaffolding - Customizable CRUD, scaffolding generation code.b:NUnit 单元测试工具(这里不多说)
c:Nant 代码自动编译工具
d:log4net 日志生成工具

最后说下S#ARP提供的项目模板文件的使用,首先把VisualStudioTemplate文件夹下的SharpArchApplicationWizard.dll拷贝到C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE(根据你安装的盘符)下;然后把VisualStudioTemplate文件夹下的SharpArchApplicationTemplate.zip压缩文件拷贝到 C:\Documents and Settings\<YOUR USERNAME>\Visual Studio 2008\Templates\ProjectTemplates\Visual C#\Web下.





通过上面的这些介绍,我想大家对S#ARP应该有了一定了解了,因此为了确保S#ARP准确运行,需安装AspNetMVC、T4 Toolbox 9.5.20.1、NUnit 2.5.0.9122。
ok,准备工作已经完成。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐