我为我的新 asp.net mvc 项目创建了以下项目结构,我在收到一些反馈后了解其他人如何构建他们的项目以及我是否会改进我的项目......
这是我到目前为止所拥有的:
+Assets
-+Images
-+Scripts
-+Stylesheets
-+... 'More things like the above here
+Controllers
-+Support
--+Actions 'Any custom action classes
--+Controllers 'Base controller classes
+Models
-+Domain 'Contains any class that specialise view specific domain logic
--+UrlProcessing 'Encoding/decoding business entities as URL parts
--+... 'More things like the above here
-+Views 'Contains view models
--+Support
---+Views 'Base classes for any view models
+Support
-+Application 'Global application interface classes (i.e. class that wraps the function of the global asax)
-+Configuration 'Typed config classes
-+Helpers 'Where you put additional html helper classes, etc
-+Services
--+Bootstrap 'Tasks that run on mvc start-up that are specific to the MVC project
--+Inversion 'Specific IoC registration registrations for this project
--+... 'More things like the above here
+Views
-+Home
-+Shared
-+... 'More things like the above here
干杯安东尼
MVC Site
app - 所有静态文件
- 常见的
----css
------样式-most-pages-use.css
----图片
------images-most-pages-use.png
----js
------your-custom-lib.js
--files
----release_notes.md
----release_notes.html
--pages
- - 登入
------登录.css
------标志.png
------signin.js
- - 仪表板
------仪表板.js
--供应商
----jquery
------jquery.1.11.1.js
-_references.js
控制器 -只有瘦控制器,只需编写代码来调用您的核心库函数
楷模 -仅用于显示视图的模型
意见 -仅客户端代码,如 html、razor、css 等
核心库
基本上所有代码...数据访问、自定义属性、实用程序等。
出于多种原因,将核心代码分离为一个库很方便。
您的逻辑现在不仅仅与网站相关。如果我需要的话我可以建造
WinForms 中的快速前端来测试一些逻辑,或者我可以使用相同的
数据访问层中的函数为数据库构建管理前端。
我发现这种结构对我来说是最简单、最灵活的。
Update
我更新了静态内容文件结构,使其更加灵活和现代。
我在使用 AngularJS 时想出了这个结构。我最终转向
RactiveJS。迁移到 RactiveJS 后,相同的结构运行得非常好。
2015 年 8 月 21 日更新我最近一直致力于较大的项目,并将 Core 库分离到它自己的 Visual Studio 项目中。这使得使用 SVN 外部时变得灵活。我可以在不同的项目中使用相同的库,并且只需要执行 SVN 更新即可获取更改。在自己的项目中也爆发了 MVC 站点。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)