<Pro ASP.NET MVC 5> - Note02
来源:互联网 发布:the weeknd earned it 编辑:程序博客网 时间:2024/06/03 19:41
CHAPTER 3: The MVC Pattern
Building Loosely Coupled Components
- Implement an interface that defines all of the public functions required.
- By introducing interface, I ensure that there is no direct dependency between the function user and its implementation.
Using Dependency Injection
Breaking and Declaring Dependencies
public class PasswordResetHelper {private IEmailSender emailSender;public PasswordResetHelper(IEmailSender emailSenderParam) {emailSender = emailSenderParam;}public void ResetPassword() {// ...call interface methods to configure e-mail details...emailSender.SendEmail();}}
Injecting Dependencies
Using a Dependency Injection Container
- I register the set of interfaces or abstract types that my application uses with the DI container, and specify which implementation classes should be instantiated to satisfy dependencies.
- The DI container puts information together, creates the MyEmailSender object and then uses it as an argument to create a PasswordResetHelper object, which I am then able to use in the application.
- It is important to note that I no longer create the objects in my application myself using the new keyword. Instead, I go to the DI container and request the objects I need.
- Ninject, you can get details at www.ninject.org.
Getting Started with Automated Testing
Understanding Unit Testing
Understanding Integration Testing
Selenium RC (http://seleniumhq.org/), which consists of a Java "server" application that can send automation commands to Internet Explorer, Firefox, Safari, or Opera, plus clients for .NET, Python, Ruby, and multiple others so that you can write test scripts in the language of your choice. Selenium is powerful and mature; its only drawback is that you have to run its Java server.
CHAPTER 6: Essential Tools for MVC
Using Ninject
The idea is to decouple the components in an MVC application, with a combination of interfaces and DI container that creates instances of objects by creating implementations of the interfaces they depend on and injecting them into the constructor.
- <Pro ASP.NET MVC 5> - Note02
- <Pro ASP.NET MVC 5> - Note01
- Pro ASP.NET Core MVC(二)【第一个MVC 应用程序】
- 《Pro ASP.NET MVC 3 Framework》译文目录
- Note on <Pro ASP.NET MVC 4> - 01
- Pro ASP.NET MVC –第五章 使用Razor
- Pro ASP.NET Core MVC(一)【前世今生】
- Pro ASP.NET Core MVC(四)【C#关键特征】
- Note02
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- ASP.NET MVC 5
- Leetcode :3. Longest Substring Without Repeating Characters
- 第3周项目3-求集合并集
- 排序算法之一--直接插入排序
- 在单链表上实现插入排序
- 第三周 项目四——顺序表应用(2)
- <Pro ASP.NET MVC 5> - Note02
- poj3686 The Windy's(拆点,费用流,好题)
- 详细解读LruCache类
- Leetcode:4. Median of Two Sorted Arrays
- C#控制台基础 创建文件夹
- 常用正则表达式实例
- 第三周 项目1-顺序表的基本运算
- 青岛网赛 1006 HDU 5883 The Best Path
- 自定义UIPresentationController