终极Visual Studio解决方案结构 [英] The Ultimate Visual Studio Solution Structure

查看:213
本文介绍了终极Visual Studio解决方案结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实现了基于手头的项目,这可能是主观的,我在找一个构建VS(Visual Studio中)解决方案的最佳实践的方法。

Realizing that this could be subjective based on the project at hand, I'm looking for the "best practice" method of structuring a VS (Visual Studio) Solution.

请随意编辑此,评论你的想法可能是不正确的,提出其他建议,等等。我很乐意看到这个社区维基长成的人刚开始使用VS解决方案的巨大资源。

Please feel free to edit this, comment on what you think might be incorrect, suggest alternatives, etc. I'd love to see this Community Wiki grow into a great resource for people just starting with VS Solutions.

下面是我现在的工作,我(对我目前的项目),但我知道一个事实,那就是放错了地方的一些东西。 在我的方案,我建立一个 Web应用程序使用的 MVC 2

Below is what I have working for me now (on my current project), however I know for a fact that there is some stuff in the wrong place. In my scenario, I'm building a Web Application using MVC 2

请发表您的终极解决方案结构的想法,这样我们可以得到的最佳途径/最佳实践的想法(是什么意思完全相同的)

Please post your idea of the ultimate solution structure so that we can get an idea of the "best way" / "best practice" (whatever that means exactly)

IE浏览器:
你怎么打破你的DAL(数据访问层)/ BLL(业务逻辑层)?
你把你的资料库层和服务层的BLL里面? 如果你使用MVC(模型 - 视图 - 控制器),保持你的控制器在UI,而不是核心?
难道你把很多东西在你的工具/文件夹杂,或者你甚至进一步打破它拆开?
等等...

IE:
How do you break up your DAL (Data-Access-Layer) / BLL (Business-Logic-Layer)?
Do you put your repository layer and service layer inside your BLL? If you're using MVC (Model-View-Controller), do you keep your controllers in the UI instead of the Core?
Do you throw lots of stuff in your Utility/Miscellaneous folders, or do you break it apart even further?
etc...

      
  • MySolution
      
        
    • MySolution.Core   
          
      • 验证   
            
        • 这是我有一个POCO和方法searialize的POCO到身份验证cookie的
        • 的用户数据secion   
        • MySolution
          • MySolution.Core
            • Authentication
              • this is where I have a POCO and a method to searialize the poco into the userData secion of the auth cookie
            
        • 这里是我把我的BaseController和BaseGlobal
        •   
        • here is where I keep my BaseController and by BaseGlobal
            
        • 我所有的控制器(显然)
        •   
        • all of my controllers (obviously)
            
        • DatabaseModels   
              
          • 包含我L2S .dbml文件
          •   
          • DatabaseModels
            • contains my L2S .dbml file
                
            • 使用JSON对象传递给教职员模型
            •   
            • models used to pass JSON objects to the veiw
                
            • 所有的扩展方法
            •   
            • all extension methods
                
            • 操作过滤器
            •   
            • Action Filters
                
            • 蜜蜂   
                  
              • 所有第三方API code去这里
              •   
              • Apis
                • all third party API code goes in here
                    
                • 徽章计算放在这里
                •   
                • badge calculation goes here
                    
                • 在这里发送邮件使用的类纯文本或HTML电子邮件
                •   
                • send plain text or html email using the classes in here
                    
                • 包含一个类,使小写路线
                •   
                • contains a class to enable lowercase routes
                    
                • App_Browsers文件
                •   
                • 资产
                    
                      
                  • 的CSS
                  •   
                  • 图片
                  •   
                  • 脚本
                  •   
                  • App_Browsers
                  • Assets
                    • Css
                    • Images
                    • Scripts

                    屏幕快照


                    Screen Shots

                    请随意据此发表评论,或者更好的是,后下你自己的版本(答案)。我知道,我所得到的是不是最好的方式。

                    Please feel free to comment accordingly, or better yet, post your own version (answer) below. I know that what I've got isn't the best way.

                    推荐答案

                    您的解决方案/项目结构看起来pretty的声音给我。如果你从来没有采取一起来看看小号#ARP建筑,你可能想。你的结构和S#ARP架构之间的主要区别是使得S#ARP的同时中断控制器,服务和存储库为单独的项目。这样做的主要好处是,它变得更容易执行对你的依赖边界(例如从核心code,你会不小心访问数据访问特​​定库)。

                    Your solution/project structure looks pretty sound to me. If you've never taken a look at S#arp Architecture, you may want to. The main difference between your structure and S#arp's architecture is that S#arp's breaks out the Controllers, Services, and Repositories into separate projects. The main benefit of doing this is that it becomes easier to enforce boundaries on your dependencies (e.g. you won't accidentally access data access specific libraries from code in Core).

                    除此之外,你的结构看起来非常相似的一个我倾向于使用我的项目。我还添加了一个扩展文件夹中的扩展方法,这是因为它们有时很难找到一个好地方。

                    Other than that, your structure looks very similar to the one I tend to use for my projects. I also add an "Extensions" folder for extension methods, since those are sometimes hard to find a good place for.

                    这篇关于终极Visual Studio解决方案结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆