你的位置: 码友网首页 / 资讯源列表 / Implementing a Custom TypeConverter In Razor Pages

关于[Implementing a Custom TypeConverter In Razor Pages]的摘要:

In my most recent article, I showed how to create a custom model binder to bind an ISO 8601 string representation of a week of the year to a DateTime type in a Razor Pages application. The custom model binder leant heavily on the existing infrastructure that binds strings to simple types. Custom model binders are the correct solution if you want to bind to simple types, but if you want to bind to a complex type, the recommendation is to implement a TypeConverter according to the offical docs. But the docs don't provide an example that shows how to do that in the context of model binding. So here's one.

原文地址: https://www.mikesdotnetting.com/article/354/implementing-a-custom-typeconverter-in-razor-pages

收录时间: 2020-11-26 浏览量: 950 分类: ASP.NET Core

| 0 收藏 | 0