示例#1
0
        /// <summary>
        /// Gets the model name.
        /// </summary>
        /// <param name="model">The Edm model.</param>
        /// <returns>The Edm model name.</returns>
        public static string GetModelName(this IEdmModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            ModelNameAnnotation annotation =
                model.GetAnnotationValue <ModelNameAnnotation>(model);

            if (annotation != null)
            {
                return(annotation.ModelName);
            }

            return(SetModelName(model));
        }
        /// <summary>
        /// Gets the model name.
        /// </summary>
        /// <param name="model">The Edm model.</param>
        /// <returns>The Edm model name.</returns>
        public static string GetModelName(this IEdmModel model)
        {
            if (model == null)
            {
                throw Error.ArgumentNull(nameof(model));
            }

            ModelNameAnnotation annotation =
                model.GetAnnotationValue <ModelNameAnnotation>(model);

            if (annotation != null)
            {
                return(annotation.ModelName);
            }

            string name = Guid.NewGuid().ToString();

            SetModelName(model, name);
            return(name);
        }