private static IEnumerable <ColumnMappingBuilder> GetFlattenedProperties( IEnumerable <PropertyMapping> propertyMappings, List <EdmProperty> propertyPath) { foreach (PropertyMapping propertyMapping in propertyMappings) { propertyPath.Add(propertyMapping.Property); ComplexPropertyMapping storageComplexPropertyMapping = propertyMapping as ComplexPropertyMapping; if (storageComplexPropertyMapping != null) { foreach (ColumnMappingBuilder flattenedProperty in MappingFragment.GetFlattenedProperties((IEnumerable <PropertyMapping>)storageComplexPropertyMapping.TypeMappings.Single <ComplexTypeMapping>().PropertyMappings, propertyPath)) { yield return(flattenedProperty); } } else { ScalarPropertyMapping storageScalarPropertyMapping = propertyMapping as ScalarPropertyMapping; if (storageScalarPropertyMapping != null) { yield return(new ColumnMappingBuilder(storageScalarPropertyMapping.Column, (IList <EdmProperty>)propertyPath.ToList <EdmProperty>())); } } propertyPath.Remove(propertyMapping.Property); } }