|
1 | 1 | using ChameleonForms.Attributes;
|
2 | 2 | using ChameleonForms.ModelBinders;
|
3 | 3 | using System;
|
| 4 | +using System.Linq; |
4 | 5 | using System.Web.Mvc;
|
5 | 6 |
|
6 |
| -[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.RegisterChameleonFormsComponents), "Start")] |
| 7 | +[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.RegisterChameleonFormsComponents), "Start")] |
7 | 8 |
|
8 |
| -namespace $rootnamespace$.App_Start |
| 9 | +namespace $rootnamespace$ |
9 | 10 | {
|
10 | 11 | public static class RegisterChameleonFormsComponents
|
11 | 12 | {
|
12 | 13 | public static void Start()
|
13 | 14 | {
|
14 |
| - System.Web.Mvc.ModelBinders.Binders.Add(typeof(DateTime), new DateTimeModelBinder()); |
15 |
| - System.Web.Mvc.ModelBinders.Binders.Add(typeof(DateTime?), new DateTimeModelBinder()); |
| 15 | + ModelBinders.Binders.Add(typeof(DateTime), new DateTimeModelBinder()); |
| 16 | + ModelBinders.Binders.Add(typeof(DateTime?), new DateTimeModelBinder()); |
16 | 17 | DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(RequiredFlagsEnumAttribute), typeof(RequiredAttributeAdapter));
|
17 |
| - GetType().Assembly.GetTypes().Where(t => t.IsEnum && t.GetCustomAttributes(typeof(FlagsAttribute), false).Any()) |
| 18 | + typeof(RegisterChameleonFormsComponents).Assembly.GetTypes().Where(t => t.IsEnum && t.GetCustomAttributes(typeof(FlagsAttribute), false).Any()) |
18 | 19 | .ToList().ForEach(t =>
|
19 | 20 | {
|
20 |
| - System.Web.Mvc.ModelBinders.Binders.Add(t, new FlagsEnumModelBinder()); |
21 |
| - System.Web.Mvc.ModelBinders.Binders.Add(typeof(Nullable<>).MakeGenericType(t), new FlagsEnumModelBinder()); |
| 21 | + ModelBinders.Binders.Add(t, new FlagsEnumModelBinder()); |
| 22 | + ModelBinders.Binders.Add(typeof(Nullable<>).MakeGenericType(t), new FlagsEnumModelBinder()); |
22 | 23 | });
|
23 | 24 | }
|
24 | 25 | }
|
|
0 commit comments