private TypeBuilder FindLocationForProperty(ByNameGrouping type,
                                             ITypeDescription forType)
 {
     if (type.HasMultipleValues)
     {
         var typeNameSeparation = forType.TypeName.NameAndNamespace.LastIndexOf('.');
         var namespaceName      = forType.TypeName.NameAndNamespace.Substring(0, typeNameSeparation);
         return(GetOrCreateNamespaceFor(namespaceName));
     }
     return(rootType);
 }
 private void CreateEntries(ByNameGrouping type)
 {
     foreach (var typeToBuildFor in type.Members)
     {
         var definePropertyOn = FindLocationForProperty(type, typeToBuildFor.Key);
         var querableType     = propertyTypeBuilder(typeToBuildFor.Value, typeToBuildFor.Key);
         var nameOfProperty   = NameOfProperty(typeToBuildFor.Key);
         var property         = CodeGenerationUtils.DefineProperty(definePropertyOn, nameOfProperty, querableType);
         var getterMethod     = CodeGenerationUtils.GetterMethodFor(definePropertyOn, property, QueryPropertyAccessRights(definePropertyOn));
         buildPropertyOnType(getterMethod, typeToBuildFor.Value,
                             typeToBuildFor.Key);
     }
 }
 private TypeBuilder FindLocationForProperty(ByNameGrouping type,
     ITypeDescription forType)
 {
     if (type.HasMultipleValues)
     {
         var typeNameSeparation = forType.TypeName.NameAndNamespace.LastIndexOf('.');
         var namespaceName = forType.TypeName.NameAndNamespace.Substring(0, typeNameSeparation);
         return GetOrCreateNamespaceFor(namespaceName);
     }
     return rootType;
 }
 private void CreateEntries(ByNameGrouping type)
 {
     foreach (var typeToBuildFor in type.Members)
     {
         var definePropertyOn = FindLocationForProperty(type, typeToBuildFor.Key);
         var querableType = propertyTypeBuilder(typeToBuildFor.Value,typeToBuildFor.Key);
         var nameOfProperty = NameOfProperty(typeToBuildFor.Key);
         var property = CodeGenerationUtils.DefineProperty(definePropertyOn, nameOfProperty, querableType);
         var getterMethod = CodeGenerationUtils.GetterMethodFor(definePropertyOn, property, QueryPropertyAccessRights(definePropertyOn));
         buildPropertyOnType(getterMethod, typeToBuildFor.Value,
             typeToBuildFor.Key);
     }
 }