惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Scott Helme
Scott Helme
N
Netflix TechBlog - Medium
AI
AI
Security Latest
Security Latest
GbyAI
GbyAI
P
Proofpoint News Feed
Y
Y Combinator Blog
A
Arctic Wolf
G
Google Developers Blog
U
Unit 42
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
T
Tor Project blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
C
Check Point Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
Latest news
Latest news
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
WordPress大学
WordPress大学
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
The Hacker News
The Hacker News
Simon Willison's Weblog
Simon Willison's Weblog
V
V2EX
Project Zero
Project Zero
博客园_首页

博客园 - 四眼蒙面侠

BMAD Loop:把开发循环的控制权,交还给确定性代码 从 Agent 到代码:Claude Code 编排模型的演进 BMAD Story Automator 上手实录:把 5 个待办 Story 交给 AI 自主推进 深入 SwiftWork(第 0 篇):用 SwiftUI 构建一个 Agent 可视化工作台 深入 Open Agent SDK(番外篇):实战验证——把 SDK 塞进一个 macOS 原生 Agent 应用 深入 Open Agent SDK(六):多 LLM 提供商与运行时控制 深入 Open Agent SDK(五):会话持久化与安全防线 深入 Open Agent SDK(四):多 Agent 协作——子代理、团队与任务编排 深入 Open Agent SDK(三):MCP 集成实战——让 Agent 连接万物 深入 Open Agent SDK(二):34 个工具的背后——工具协议、三层架构与自定义扩展 深入 Open Agent SDK(一):Agent Loop 内核——从 prompt 到多轮对话的完整运转机制 Open Agent SDK (Swift):用原生 Swift 构建 AI Agent 应用 BMAD开发效率翻倍: 一条命令交付整个Epic BMad v6实战过程全公开:32场对话揭秘人机协作怎么搞? AutoQA-Agent:用 Markdown 写验收用例,AI + Playwright 跑起来,跑通还能导出成 Playwright Test 我在Claude Code状态栏养了一个电子宠物 ccshell – 基于Claude Code的自然语言Shell命令工具 用 Planet + ENS 构建一个真正去中心化的博客 BMAD-METHOD:让一个人顶一个敏捷团队的 AI 驱动开发框架 Claude Code 深夜也要加班?这个神器让 AI 自动续命! 告别脆弱的 Playwright 测试:为什么基于 YAML 的测试是未来趋势 来个好玩的,用手机随时随地指挥你的 Cursor! 开源一个练手小App, PrintableCheckList Swift 和 C# 的语法比较 发布一个基于newsyc修改的StartupNews的iOS客户端 (PHP)使用Behat和Mink对Web应用做BDD(行为测试驱动开发) 微博应用--PC遥控器 正式开源 新浪微博小工具--PC遥控器1.0发布 Brad Wilson写的 ASP.NET MVC 3 Service Location 系列文章索引 【转】ASP.NET MVC 3 Service Location, Part 11: View Page Activator 【转】ASP.NET MVC 3 Service Location, Part 8: Value Providers 【转】ASP.NET MVC 3 Service Location, Part 9: Model Binders
【转】ASP.NET MVC 3 Service Location, Part 10: Controller Activator
四眼蒙面侠 · 2011-01-25 · via 博客园 - 四眼蒙面侠

Controller Activator

In MVC 1.0, we introduced IControllerFactory to allow better dependency injection of controller instances. We also provided theDefaultControllerFactory, which created controller instances with Activator.CreateInstance. Some of this is discussed in Part 2 of this series.

We realized that DefaultControllerFactory was actually doing two things: turning the controller name into the controller type, and then instantiating the instance of that type. In ASP.NET MVC 3, we’ve split out the action of instantiating the controller instance into a new service: IControllerActivator. We have made the IControllerActivator instance findable via the dependency resolver.

Disclaimer

This blog post talks about ASP.NET MVC 3 Beta, which is a pre-release version. Specific technical details may change before the final release of MVC 3. This release is designed to elicit feedback on features with enough time to make meaningful changes before MVC 3 ships, so please comment on this blog post or contact me if you have comments.

Implementing IControllerActivator

The new IControllerActivator signature is identical to the DefaultControllerFactory.GetControllerInstance virtual method:

public interface IControllerActivator {
    IController Create(RequestContext requestContext, Type controllerType);
}

Developers who previously implemented IControllerFactory by deriving from DefaultControllerFactory just to override the GetControllerInstance method for dependency injection purposes should now implement IControllerActivator instead.

Location: IControllerActivator

This is a “singly registered” style service introduced in MVC 3. There is no static registration point for this service as its purpose is strictly to support dependency injection; as such, the only way to register an instance of this service is through the dependency resolver.

The logic in DefaultControllerFactory was updated to consult the dependency resolver, calling GetSerivce(typeof(IControllerActivator)) and using the provided service when present. If there is no IControllerActivator present in the dependency resolver, we will then ask the dependency resolver to create the concrete controller type by calling GetService(controllerType). If the dependency resolver also fails to create the concrete controller type, we finally fall back to the MVC 2 behavior of using Activator.CreateInstance to create the controller type.

What’s Next?

In the final post of this series, we will discuss the new View Page Activator service.