Skip to content

Instantly share code, notes, and snippets.

@lindstromhenrik
Created January 28, 2013 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindstromhenrik/4654694 to your computer and use it in GitHub Desktop.
Save lindstromhenrik/4654694 to your computer and use it in GitHub Desktop.
Excluding CultureInfo from the type of nested object.
// 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