public static IEdmModel BuildEdmModel(ODataModelBuilder builder)
        {
            if (builder == null)
            {
                throw Error.ArgumentNull("builder");
            }

            EdmModel           model     = new EdmModel();
            EdmEntityContainer container = new EdmEntityContainer(builder.Namespace, builder.ContainerName);

            // add types and sets, building an index on the way.
            Dictionary <Type, IEdmStructuredType> edmTypeMap      = model.AddTypes(builder.StructuralTypes);
            Dictionary <string, EdmEntitySet>     edmEntitySetMap = model.AddEntitySets(builder, container, edmTypeMap);

            // add procedures
            model.AddProcedures(builder.Procedures, container, edmTypeMap, edmEntitySetMap);

            // finish up
            model.AddElement(container);
            model.SetIsDefaultEntityContainer(container, isDefaultContainer: true);

            // build the map from IEdmEntityType to IEdmFunctionImport
            model.SetAnnotationValue <BindableProcedureFinder>(model, new BindableProcedureFinder(model));

            // set the data service version annotations.
            model.SetDataServiceVersion(builder.DataServiceVersion);
            model.SetMaxDataServiceVersion(builder.MaxDataServiceVersion);

            return(model);
        }
        public static IEdmModel BuildEdmModel(ODataModelBuilder builder)
        {
            if (builder == null)
            {
                throw Error.ArgumentNull("builder");
            }

            EdmModel           model     = new EdmModel();
            EdmEntityContainer container = new EdmEntityContainer(builder.Namespace, builder.ContainerName);

            // add types and sets, building an index on the way.
            Dictionary <string, IEdmStructuredType> edmTypeMap      = model.AddTypes(builder.StructuralTypes);
            Dictionary <string, EdmEntitySet>       edmEntitySetMap = model.AddEntitySets(builder.EntitySets, container, edmTypeMap);

            // add procedures
            container.AddProcedures(builder.Procedures, edmTypeMap, edmEntitySetMap);

            // finish up
            model.AddElement(container);
            return(model);
        }