Created
January 28, 2013 11:14
-
-
Save lindstromhenrik/4654694 to your computer and use it in GitHub Desktop.
Excluding CultureInfo from the type of nested object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NestedFieldNameConvention | |
// we want to nest only lists of objects not previously mapped to a specific type by EPiServer Find | |
if ((type.GetGenericTypeDefinition() == typeof(IEnumerable<>)) | |
&& !(type.GetGenericArguments()[0].IsValueType || type.GetGenericArguments()[0] == typeof(string) || type.GetGenericArguments()[0] == typeof(DateTime) || type.GetGenericArguments()[0] == typeof(CultureInfo)) | |
&& !fieldName.Contains("$$") | |
&& !fieldName.StartsWith("__")) | |
{ | |
fieldName += "$$nested"; | |
} | |
// IncludeTypeNameInNestedFieldNamesInterceptor | |
// we want to nest only lists of objects not previously mapped to a specific type by EPiServer Find | |
if ((type.GetGenericTypeDefinition() == typeof(IEnumerable<>)) | |
&& !(type.GetGenericArguments()[0].IsValueType || type.GetGenericArguments()[0] == typeof(string) || type.GetGenericArguments()[0] == typeof(DateTime) || type.GetGenericArguments()[0] == typeof(CultureInfo)) | |
&& !property.PropertyName.Contains("$$") | |
&& !property.PropertyName.StartsWith("__")) | |
{ | |
property.PropertyName = property.PropertyName + "$$nested"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment