// <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>
        internal static string GetStorageEntityTypeName(EntityType entityType, EdmItemCollection edm)
        {
            var storageEntityTypeName = String.Empty;

            // 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.
            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;
        }