终极Visual Studio解决方案结构

编程入门 行业动态 更新时间:2024-10-20 00:34:48
本文介绍了终极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解决方案结构

本文发布于:2023-11-13 14:41:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584606.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   结构   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!