ASP.NET 解决方案的典型结构?

发布于 2024-07-16 03:45:52 字数 298 浏览 3 评论 0原文

正如标题所示,我很想知道您通常如何构建 ASP.NET 解决方案。

我对 ASP.NET WebSite 解决方案特别感兴趣,但有关其他类型(WebApplication、MVC)的信息也可能很有趣。

一些具体问题:

  • 解决方案包含哪些/多少个项目/程序集,
  • 如何命名类库项目,
  • 通常有哪些命名空间,
  • 每个项目/程序集是否有多个命名空间,或者是否有严格的 1:1 关系
  • 等。

谢谢

As the title says, I'm interested to know how you typically structure your ASP.NET solutions.

I'm especially interested in ASP.NET WebSite solutions, but information abut other types (WebApplication, MVC) might be interesting as well.

Some specific questions:

  • what/how many projects/assemblies does the solution contain
  • how do you name your class library projects
  • what namespaces do you typically have
  • do you have multiple namespaces per project/assembly or do you have a strict 1:1 relation
  • etc.

Thanks

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

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

发布评论

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

评论(3

地狱即天堂 2024-07-23 03:45:52

我的项目之一如下:

  • Sln
    • Sln.Core
    • Sln.Core.Test
    • Sln.Data
    • Sln.Data.Test
    • Sln.Web
    • Sln.Web.Test

Core 是域模型和域服务,只要它们可以在不进入持久性的情况下完成。 数据是持久层,它基本上意味着 FluentNHibernate 定义和 Core 中定义的接口的具体实现。 Web是前端层。

One of my projects looks like:

  • Sln
    • Sln.Core
    • Sln.Core.Test
    • Sln.Data
    • Sln.Data.Test
    • Sln.Web
    • Sln.Web.Test

Core is the domain model and domain services, as far as they can be done without stepping into persistence. Data is the persistence layer, which basically means FluentNHibernate definitions and concrete implementations of interfaces defined in Core. Web is the front-end layer.

想你只要分分秒秒 2024-07-23 03:45:52

我也做过类似正义的事情。 但是,随着项目数量的减少(编译时间的加快),

Sln

  • Project.Core
  • Project.Web
  • Project.Test

Project.Core 看起来会像这样:

  • Repository
  • Domain
  • Presenter
  • Service
  • View
  • Common

我并没有真正从多个(超过 3 个)项目中获益。 您无法获得可测试性,并且编译时间会变得更长。

另外,当我获得一个网站项目时,我做的第一件事就是将其转换为一个 Web 应用程序。 但总的来说,当我在网站和 Web 应用程序之间切换时,我的项目不会发生变化。

I have done something similar to Justice. But with fewer projects (and faster compile time)

Sln

  • Project.Core
  • Project.Web
  • Project.Test

Project.Core will look like this

  • Repository
  • Domain
  • Presenter
  • Service
  • View
  • Common

I don't really get an benefit from multiple (more than 3) projects. You don't gain testablility, and your compile times get much longer.

Also, the first thing I do when I get a Web Site project is convert it so a web application. But overall, my projects don't change when I switch between Web Sites and Web Applications.

顾忌 2024-07-23 03:45:52

我通常使用应用程序的名称作为解决方案名称(使用通用的“解决方案”项目类型),然后为它包含的项目使用 SolutionName.Site、SolutionName.Domain、SolutionName.Persistence 等。 它似乎使处理所有参考文献变得更加容易。

不过我想看看其他人的答案。 虽然这是我发现的最好的方法,但我无法摆脱可能有更好的方法的感觉。

I typically use the name of the application for a solution name (using the generic "Solution" project type), then have SolutionName.Site, SolutionName.Domain, SolutionName.Persistence, etc... for the projects it contains. It seems to make it easier to deal with all the references.

I'd like to see other peoples answers though. While this is the best way I've found I can't shake the feeling that there might be a better one.

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