VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 编程开发 > c#教程 >
  • C#教程之C#教程之入门(2)

本站最新发布   C#从入门到精通
试听地址  
https://www.xin3721.com/eschool/CSharpxin3721/

在第二个示例代码中,ManagementController 类现在依赖ITenantStore 抽象,TenantStore 类也是如此。
Summary

总结
In this chapter, you have seen how you can address some of the common requirements in enterprise applications such as maintainability and testability by adopting a loosely coupled design for your application. You saw a very simple illustration of this in the code samples that show two different ways that you can implement the dependency between the ManagementController and TenantStore classes. You also saw how the SOLID principles of object-oriented programming relate to the same concerns.
However, the discussion in this chapter left open the question of how to instantiate and manage TenantStoreobjects if the ManagementController is no longer responsible for this task. The next chapter will show how dependency injection relates to this specific question and how adopting a dependency injection approach can help you meet the requirements and adhere to the principles outlined in this chapter.

在本章中,您已经了解了如何通过为您的应用程序采用松耦合设计来解决企业应用程序中的一些常见要求,如可维护性和可测试性。您在代码示例中看到了一个非常简单的例子,它展示了两种不同的方法,您可以实现ManagementControllerTenantStore类之间的依赖关系。另外你也看到面向对象SOLID原则如何设计涉及这些关注。

但是,本章讨论遗留一个问题,如果ManagementController不再负责这个任务,那么如何实例化和管理TenantStore 对象。在下一章将会显示使用依赖注入如何与具体问题相关和采用依赖注入方法如何帮助您满足要求并遵守本章中概述的原则。

More Information

相关教程