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

推荐订阅源

Spread Privacy
Spread Privacy
T
Threatpost
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
I
InfoQ
大猫的无限游戏
大猫的无限游戏
博客园_首页
爱范儿
爱范儿
有赞技术团队
有赞技术团队
V
Visual Studio Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Jina AI
Jina AI
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CERT Recently Published Vulnerability Notes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
K
Kaspersky official blog
L
LangChain Blog
G
GRAHAM CLULEY
B
Blog RSS Feed
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Help Net Security
Help Net Security
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
雷峰网
雷峰网
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
Vercel News
Vercel News
T
Tor Project blog
T
The Exploit Database - CXSecurity.com
T
Troy Hunt's Blog
W
WeLiveSecurity
T
Threat Research - Cisco Blogs

博客园 - 四眼蒙面侠

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 10: Controller Activator 【转】ASP.NET MVC 3 Service Location, Part 9: Model Binders
【转】ASP.NET MVC 3 Service Location, Part 8: Value Providers
四眼蒙面侠 · 2011-01-25 · via 博客园 - 四眼蒙面侠

Value Providers

ASP.NET MVC 2 introduced a new method to find value providers: the ValueProviderFactory class. Value providers are used by the model binding system in MVC to populate the values of model objects. MVC includes value providers for several common value sources (including query string, form, route data, uploaded files, and JSON postbacks); MVC Futures includes several mode (including cookies, server values, session values, and temp data values). In ASP.NET MVC 3, we have made ValueProviderFactory instances 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 ValueProviderFactory

Developers who implement this class must provide an implementation of GetValueProvider which, given a controller context, optionally returns an instance of a class which implements the IValueProvider interface. The developer may also choose to return null if there is no appropriate value provider or values.

For reference purposes, there are several implementations of ValueProviderFactory in the MVC and MVC Futures source code. For a simple example, see the pair of classes: QueryStringValueProviderFactory and QueryStringValueProvider.

Implementing IValueProvider

Developers who implement this interface provide implementations of two methods: ContainsPrefix and GetValue. The former method is used to determine if there are any values in the provider with the given prefix (so the model binding system knows when to stop recursively binding). The latter method is used to get the value for a specific key.

There are two implementations of IValueProvider (NameValueCollectionValueProvider and DictionaryValueProvider) will accept collections of values to be used for the value provider implementation. Most of the value providers in the MVC source code actually derive from one of these two base classes.

Location: ValueProviderFactory

This is a “multiply registered” style service introduced in MVC 2. The static registration point for this service is atValueProviderFactories.Factories for non-DI users.

The logic in ValueProviderFactoryCollection (which implements ValueProviderFactories.Factories) was updated to consult the dependency resolver, calling GetServices(typeof(ValueProviderFactory)) and adding any services found to the list of statically registered services. Value providers all collaborate to provide values for model binding, with a “first one to provide the value wins” strategy, so registration order is important. The factories found in the dependency resolver will always run in the order they are returned from the resolver (and before the statically registered value provider factories); similarly, the value providers will be consulted in the order they are returned from the factories.

What’s Next?

Next up we’ll talk about Model Binders.