private IEdmModel ModelDB()
        {
            try
            {
                #region odata
                var       optionsBuilder = new DbContextOptionsBuilder <DynamicDbContext>();
                IEdmModel edmModel;
                //optionsBuilder = optionsBuilder.UseSqlServer("Server=.;Initial Catalog=test;Trusted_Connection=No;UID=sa;PWD=Your_password123;Connect Timeout=5");
                //using (var providerSchema = new SqlServerSchema(optionsBuilder.Options))

                var con = Environment.GetEnvironmentVariable("MySql");
                optionsBuilder = optionsBuilder.UseMySQL(con);
                using (var providerSchema = new MySqlSchema(optionsBuilder.Options))
                //var con = Environment.GetEnvironmentVariable("Postgres");
                //optionsBuilder = optionsBuilder.UseNpgsql(con);
                //using (var providerSchema = new PostgreSqlSchema(optionsBuilder.Options))
                {
                    edmModel = DynamicMiddlewareHelper.CreateEdmModel(providerSchema, informationSchemaMapping: null);
                }
                return(edmModel);

                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine($" exception {ex.Message}");
                return(null);
            }
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            String basePath           = Configuration.GetValue <String>("OdataToEntity:BasePath");
            String provider           = Configuration.GetValue <String>("OdataToEntity:Provider");
            String connectionString   = Configuration.GetValue <String>("OdataToEntity:ConnectionString");
            bool   useRelationalNulls = Configuration.GetValue <bool>("OdataToEntity:UseRelationalNulls");
            String informationSchemaMappingFileName = Configuration.GetValue <String>("OdataToEntity:InformationSchemaMappingFileName");

            if (!String.IsNullOrEmpty(basePath) && basePath[0] != '/')
            {
                basePath = "/" + basePath;
            }

            InformationSchemaMapping?informationSchemaMapping = null;

            if (informationSchemaMappingFileName != null)
            {
                String json = File.ReadAllText(informationSchemaMappingFileName);
                informationSchemaMapping = Newtonsoft.Json.JsonConvert.DeserializeObject <InformationSchemaMapping>(json);
            }

            var schemaFactory = new DynamicSchemaFactory(provider, connectionString);

            using (ProviderSpecificSchema providerSchema = schemaFactory.CreateSchema(useRelationalNulls))
            {
                IEdmModel edmModel = DynamicMiddlewareHelper.CreateEdmModel(providerSchema, informationSchemaMapping);
                app.UseOdataToEntityMiddleware <OePageMiddleware>(basePath, edmModel);
            }
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            String basePath           = Configuration.GetValue <String>("OdataToEntity:BasePath");
            String provider           = Configuration.GetValue <String>("OdataToEntity:Provider");
            String connectionString   = Configuration.GetValue <String>("OdataToEntity:ConnectionString");
            bool   useRelationalNulls = Configuration.GetValue <bool>("OdataToEntity:UseRelationalNulls");
            String?informationSchemaMappingFileName = Configuration.GetValue <String>("OdataToEntity:InformationSchemaMappingFileName");
            String?filter        = Configuration.GetValue <String>("OdataToEntity:Filter");
            String?defaultSchema = Configuration.GetSection("OdataToEntity:DefaultSchema").Get <String>();

            String[]? includedSchemas = Configuration.GetSection("OdataToEntity:IncludedSchemas").Get <String[]>();
            String[]? excludedSchemas = Configuration.GetSection("OdataToEntity:ExcludedSchemas").Get <String[]>();

            if (!String.IsNullOrEmpty(basePath) && basePath[0] != '/')
            {
                basePath = "/" + basePath;
            }

            var informationSchemaSettings = new InformationSchemaSettings();

            if (!String.IsNullOrEmpty(defaultSchema))
            {
                informationSchemaSettings.DefaultSchema = defaultSchema;
            }
            if (includedSchemas != null)
            {
                informationSchemaSettings.IncludedSchemas = new HashSet <String>(includedSchemas);
            }
            if (excludedSchemas != null)
            {
                informationSchemaSettings.ExcludedSchemas = new HashSet <String>(excludedSchemas);
            }
            if (filter != null)
            {
                informationSchemaSettings.ObjectFilter = Enum.Parse <DbObjectFilter>(filter, true);
            }
            if (informationSchemaMappingFileName != null)
            {
                String json = File.ReadAllText(informationSchemaMappingFileName);
                var    informationSchemaMapping = System.Text.Json.JsonSerializer.Deserialize <InformationSchemaMapping>(json) !;
                informationSchemaSettings.Operations = informationSchemaMapping.Operations;
                informationSchemaSettings.Tables     = informationSchemaMapping.Tables;
            }

            var schemaFactory = new DynamicSchemaFactory(provider, connectionString);

            using (ProviderSpecificSchema providerSchema = schemaFactory.CreateSchema(useRelationalNulls))
            {
                IEdmModel edmModel = DynamicMiddlewareHelper.CreateEdmModel(providerSchema, informationSchemaSettings);
                app.UseOdataToEntityMiddleware <OePageMiddleware>(basePath, edmModel);
            }
        }
        private IEdmModel ModelDB()
        {
            try
            {
                #region odata
                var       optionsBuilder = new DbContextOptionsBuilder <DynamicDbContext>();
                IEdmModel edmModel;
                optionsBuilder = optionsBuilder.UseSqlServer("Server=.;Initial Catalog=test;Trusted_Connection=No;UID=sa;PWD=Your_password123;Connect Timeout=5");

                using (var providerSchema = new SqlServerSchema(optionsBuilder.Options))
                {
                    edmModel = DynamicMiddlewareHelper.CreateEdmModel(providerSchema, informationSchemaMapping: null);
                }
                return(edmModel);

                #endregion
            }
            catch (Exception)
            {
                return(null);
            }
        }