Skip to content

Commit 325225f

Browse files
authored
Merge pull request #144 from MRCollective/small-fixes
Fixing some problems with the app start file
2 parents 15aaf85 + c3de397 commit 325225f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

AppStart.cs.pp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
using ChameleonForms.Attributes;
22
using ChameleonForms.ModelBinders;
33
using System;
4+
using System.Linq;
45
using System.Web.Mvc;
56

6-
[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.RegisterChameleonFormsComponents), "Start")]
7+
[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.RegisterChameleonFormsComponents), "Start")]
78

8-
namespace $rootnamespace$.App_Start
9+
namespace $rootnamespace$
910
{
1011
public static class RegisterChameleonFormsComponents
1112
{
1213
public static void Start()
1314
{
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());
1617
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())
1819
.ToList().ForEach(t =>
1920
{
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());
2223
});
2324
}
2425
}

ChameleonForms/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ ChameleonForms
44
* For the project homepage including the current README, see https://github.com/MRCollective/ChameleonForms
55
* To check for potential breaking changes in this release, see https://github.com/MRCollective/ChameleonForms/blob/master/BREAKING_CHANGES.md
66
* If you need to raise an issue or check for an existing issue, see https://github.com/MRCollective/ChameleonForms/issues
7-
* To consult the ChameleonForms documentation, see https://github.com/MRCollective/ChameleonForms/wiki
7+
* To consult the ChameleonForms documentation, see https://chameleonforms.readthedocs.io/

0 commit comments

Comments
 (0)