当前位置: 首页>>代码示例>>C#>>正文


C# ModelBinderDictionary.Add方法代码示例

本文整理汇总了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());
 }
开发者ID:jorik041,项目名称:VerseEngineering,代码行数:8,代码来源:WebApiConfig.cs

示例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());
        }
开发者ID:sebnilsson,项目名称:WikiDown,代码行数:10,代码来源:ModelBinderConfig.cs

示例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;
 }
开发者ID:jamesej,项目名称:lynicon,代码行数:8,代码来源:LyniconBinder.cs

示例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);
			}
		}
开发者ID:UHgEHEP,项目名称:test,代码行数:14,代码来源:BinderConfig.cs

示例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);
     }
 }
开发者ID:Corniel,项目名称:Qowaiv,代码行数:20,代码来源:TypeConverterModelBinder.cs

示例6: RegisterBindings

 /// <summary>
 /// 
 /// </summary>
 /// <param name="current"></param>
 public static void RegisterBindings(ModelBinderDictionary current)
 {
     current.Add(typeof(ProductRequest), new ProductRequestBinder());
 }
开发者ID:CarlosNetMty,项目名称:Collective,代码行数:8,代码来源:BindingConfig.cs

示例7: Register

 /// <summary>
 /// Globally-used model binders
 /// </summary>
 public static void Register(ModelBinderDictionary modelBinders)
 {
     modelBinders.DefaultBinder = new CustomModelBinder();
     modelBinders.Add(typeof(BirthDateModelBinder), new BirthDateModelBinder());
 }
开发者ID:winmissupport,项目名称:FeatureUpate,代码行数:8,代码来源:GlobalModelBinders.cs

示例8: RegisterBinders

 public static void RegisterBinders(ModelBinderDictionary binders)
 {
     binders.Add(typeof(GridSettings), new GridSettingsModelBinder());
 }
开发者ID:JeyKip,项目名称:MvcErmitage,代码行数:4,代码来源:ModelBindersConfig.cs

示例9: RegisterBinders

 public static void RegisterBinders(ModelBinderDictionary binders)
 {
     binders.Add(typeof(EntidadeExterna), new EntidadeExternaBinder());
 }
开发者ID:TiagoSoczek,项目名称:MOC,代码行数:4,代码来源:BinderConfig.cs

示例10: RegisterModelBinders

 public static void RegisterModelBinders(ModelBinderDictionary binders)
 {
     binders.Add(typeof(SearchCollection), new SearchCollectionModelBinder());
 }
开发者ID:sandrapatfer,项目名称:PROMPT11-03-WebApplications.sandrapatfer,代码行数:4,代码来源:Global.asax.cs

示例11: RegisterModelBinders

 protected override void RegisterModelBinders(ModelBinderDictionary binders)
 {
     binders.Add<RestRequest, RestRequestModelBinder>(Container);
 }
开发者ID:tmont,项目名称:portoa,代码行数:4,代码来源:Global.asax.cs

示例12: RegisterBinders

 public static void RegisterBinders(ModelBinderDictionary modelBinderDictionary)
 {
     modelBinderDictionary.Add(typeof (FilterRequest), new LegacyFilterRequestModelBinder());
 }
开发者ID:offspringer,项目名称:mvc.datatables,代码行数:4,代码来源:BinderConfig.cs

示例13: RegisterModelBinders

 public static void RegisterModelBinders(ModelBinderDictionary binder)
 {
     binder.Add(typeof(DateTime?), new DateModelBinder());
 }
开发者ID:lucidcoding,项目名称:Campervibe_Booking,代码行数:4,代码来源:ModelBinderConfig.cs

示例14: Register

 public static void Register(ModelBinderDictionary binders)
 {
     var htmlStringEncodingModelBinder = new HtmlStringEncodingModelBinder();
     binders.Add(typeof(string), htmlStringEncodingModelBinder);
 }
开发者ID:supportify,项目名称:demo-asp-mvc,代码行数:5,代码来源:RegisterCustomModelBinders.cs

示例15: RegisterModelBinders

 public static void RegisterModelBinders(ModelBinderDictionary binders)
 {
     binders.Add(typeof(CustomerData), new CustomFieldNameModelBinder());
 }
开发者ID:luiseduardohdbackup,项目名称:TestMvcApplication,代码行数:4,代码来源:BindingConfig.cs


注:本文中的ModelBinderDictionary.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。