本文整理汇总了C#中ModelBinderDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ModelBinderDictionary.Add方法的具体用法?C# ModelBinderDictionary.Add怎么用?C# ModelBinderDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelBinderDictionary
的用法示例。
在下文中一共展示了ModelBinderDictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterModelBinders
public static void RegisterModelBinders(ModelBinderDictionary modelBinderDictionary)
{
modelBinderDictionary.Add(typeof(FacebookAuthResponse), new JsonModelBinder<FacebookAuthResponse>("authResponse"));
modelBinderDictionary.Add(typeof(FacebookNotificationResponse), new JsonModelBinder<FacebookNotificationResponse>("facebookNotificationResponse"));
modelBinderDictionary.Add(typeof(VerseEngineeringUser), new VerseEngineeringUserBinder());
modelBinderDictionary.Add(typeof(FacebookAccessToken), DependencyResolver.Current.GetService<FacebookAccessTokenModelBinder>());
modelBinderDictionary.Add(typeof(HideCandidateVersesFlag), new HideCandidateVersesFlagModelBinder());
}
示例2: RegisterModelBinders
public static void RegisterModelBinders(ModelBinderDictionary modelBinders, HttpConfiguration config)
{
modelBinders.Add(typeof(ArticleSlug), new ArticleSlugModelBinder());
modelBinders.Add(typeof(ArticleRevisionDate), new ArticleRevisionDateModelBinder());
modelBinders.Add(typeof(bool?), new BooleanModelBinder());
modelBinders.Add(typeof(bool), new BooleanModelBinder());
AddWebApiModelBinder(config, typeof(ArticleSlug), new ArticleSlugModelBinder());
AddWebApiModelBinder(config, typeof(ArticleRevisionDate), new ArticleRevisionDateModelBinder());
}
示例3: LyniconBinder
public LyniconBinder()
{
// Use this as the default binder in the scope of BindModel on this binder only
var binders = new ModelBinderDictionary();
ModelBinders.Binders.Do(kvp => binders.Add(kvp.Key, kvp.Value));
binders.DefaultBinder = this;
this.Binders = binders;
}
示例4: RegisterBinders
public static void RegisterBinders(ModelBinderDictionary binders)
{
var types = Assembly.GetCallingAssembly().GetTypes();
foreach (var binderType in types.Where(x => x.BaseType == typeof(DefaultModelBinder)))
{
var binder = (IModelBinder)Activator.CreateInstance(binderType);
var modelName = binderType.Name.Substring(0, binderType.Name.Length - "Binder".Length);
var type = types.First(y => y.Name == modelName);
binders.Add(type, binder);
}
}
示例5: RegisterForAll
/// <summary>Registers the model binder to the specified model binder dictionary.</summary>
/// <param name="binders">The model binder dictionary to add to.</param>
/// <remarks>
/// Typical usage:
/// <example>
/// protected override void Application_Start()
/// {
/// base.Application_Start();
/// TypeConverterModelBinder.RegisterForAll(ModelBinders.Binders);
/// }
/// </example>
/// </remarks>
public static void RegisterForAll(ModelBinderDictionary binders)
{
Guard.NotNull(binders, "binders");
foreach (var tp in TypeConverters.Keys)
{
binders.Add(tp, TypeConverterModelBinder.Instance);
}
}
示例6: RegisterBindings
/// <summary>
///
/// </summary>
/// <param name="current"></param>
public static void RegisterBindings(ModelBinderDictionary current)
{
current.Add(typeof(ProductRequest), new ProductRequestBinder());
}
示例7: Register
/// <summary>
/// Globally-used model binders
/// </summary>
public static void Register(ModelBinderDictionary modelBinders)
{
modelBinders.DefaultBinder = new CustomModelBinder();
modelBinders.Add(typeof(BirthDateModelBinder), new BirthDateModelBinder());
}
示例8: RegisterBinders
public static void RegisterBinders(ModelBinderDictionary binders)
{
binders.Add(typeof(GridSettings), new GridSettingsModelBinder());
}
示例9: RegisterBinders
public static void RegisterBinders(ModelBinderDictionary binders)
{
binders.Add(typeof(EntidadeExterna), new EntidadeExternaBinder());
}
示例10: RegisterModelBinders
public static void RegisterModelBinders(ModelBinderDictionary binders)
{
binders.Add(typeof(SearchCollection), new SearchCollectionModelBinder());
}
示例11: RegisterModelBinders
protected override void RegisterModelBinders(ModelBinderDictionary binders)
{
binders.Add<RestRequest, RestRequestModelBinder>(Container);
}
示例12: RegisterBinders
public static void RegisterBinders(ModelBinderDictionary modelBinderDictionary)
{
modelBinderDictionary.Add(typeof (FilterRequest), new LegacyFilterRequestModelBinder());
}
示例13: RegisterModelBinders
public static void RegisterModelBinders(ModelBinderDictionary binder)
{
binder.Add(typeof(DateTime?), new DateModelBinder());
}
示例14: Register
public static void Register(ModelBinderDictionary binders)
{
var htmlStringEncodingModelBinder = new HtmlStringEncodingModelBinder();
binders.Add(typeof(string), htmlStringEncodingModelBinder);
}
示例15: RegisterModelBinders
public static void RegisterModelBinders(ModelBinderDictionary binders)
{
binders.Add(typeof(CustomerData), new CustomFieldNameModelBinder());
}