src/Misc/EFTools/EntityDesignDatabaseGeneration/OutputGenerators/OutputGeneratorHelpers.cs
// <summary>
//     Infer a Storage-layer EntityType name from a Conceptual-layer EntityType
//     1. If this is a root type, then we will use the EntitySet name.
//     2. If this is a derived type, then we will return the name of the EntitySet
//     appended to the name of the EntityType.
//     * NOTE: This is better than pluralization because this scales well for international users
// </summary>
Infer a Storage-layer EntityType name from a Conceptual-layer EntityType
1. If this is a root type, then we will use the EntitySet name.
2. If this is a derived type, then we will return the name of the EntitySet
appended to the name of the EntityType.
NOTE: This is better than pluralization because this scales well for international users
Infer a Storage - layer EntityType name from a Conceptual - layer EntityType 1 . If this is a root type then we will use the EntitySet name . 2 . If this is a derived type then we will return the name of the EntitySet appended to the name of the EntityType . NOTE : This is better than pluralization because this scales well for international users
internal static string GetStorageEntityTypeName(EntityType entityType, EdmItemCollection edm)
        {
            var storageEntityTypeName = String.Empty;
            var rootOrSelf = entityType.GetRootOrSelf();
            foreach (var entitySet in edm.GetAllEntitySets())
            {
                if (rootOrSelf == entitySet.ElementType)
                {
                    storageEntityTypeName = entitySet.Name;
                }
            }
            Debug.Assert(!String.IsNullOrEmpty(storageEntityTypeName), "We didn't find an EntitySet for the EntityType " + entityType.Name);
            if (entityType.IsDerivedType())
            {
                storageEntityTypeName = String.Format(CultureInfo.CurrentCulture, "{0}_{1}", storageEntityTypeName, entityType.Name);
            }
            return storageEntityTypeName;
        }
internal static string GetStorageEntityTypeName ( EntityType entityType , EdmItemCollection edm ) { var storageEntityTypeName = String . Empty ; var rootOrSelf = entityType . GetRootOrSelf ( ) ; foreach ( var entitySet in edm . GetAllEntitySets ( ) ) { if ( rootOrSelf == entitySet . ElementType ) { storageEntityTypeName = entitySet . Name ; } } Debug . Assert ( ! String . IsNullOrEmpty ( storageEntityTypeName ) , " " + entityType . Name ) ; if ( entityType . IsDerivedType ( ) ) { storageEntityTypeName = String . Format ( CultureInfo . CurrentCulture , " " , storageEntityTypeName , entityType . Name ) ; } return storageEntityTypeName ; }
Infer a Storage-layer EntityType name from a Conceptual-layer EntityType
1.
Infer a Storage - layer EntityType name from a Conceptual - layer EntityType 1 .
// First get the EntitySet name. Unfortunately the Metadata APIs don't have the ability to // get an EntitySet from an EntityType, so we have to incur this perf hit.
entityType
EntityType
edm
EdmItemCollection