public static void  ConfigureMySql(this IServiceCollection services, string connectionString, int poolSize, IHealthChecksBuilder checksBuilder, HealthChecksUIBuilder healthChecksUI)
        {
            services.AddEntityFrameworkMySql();
            services.AddSingleton <IDataBaseModelBuilderOptions>(c => new MySqlModelBuilderOptions());
            ServerVersion serverVersion = null;

            try
            {
                serverVersion = ServerVersion.AutoDetect(connectionString);
            }
            catch (Exception ex)
            {
                throw new Exception($"Can't detect MySql server's version ,  {ex.Message} ", ex);
            }
            services.AddSingleton(serverVersion);
            services.AddDbContextPool <ApplicationDbContext>(builder =>
            {
                builder.UseInternalServiceProvider(services.BuildServiceProvider());
                builder.UseMySql(connectionString, serverVersion, s => s.MigrationsAssembly("IoTSharp.Data.MySQL"));
            }
                                                             , poolSize);

            checksBuilder.AddMySql(connectionString, "IoTSharp.Data.MySQL");
            healthChecksUI.AddMySqlStorage(connectionString);
        }
        public static void  ConfigureMySql(this IServiceCollection services, string connectionString, int poolSize, IHealthChecksBuilder checksBuilder, HealthChecksUIBuilder healthChecksUI)
        {
            services.AddEntityFrameworkMySql();
            services.AddSingleton <IDataBaseModelBuilderOptions>(c => new MySqlModelBuilderOptions());
            var sv = ServerVersion.AutoDetect(connectionString);

            services.AddSingleton(sv);
            services.AddDbContextPool <ApplicationDbContext>(builder =>
            {
                builder.UseInternalServiceProvider(services.BuildServiceProvider());
                builder.UseMySql(connectionString, sv, s => s.MigrationsAssembly("IoTSharp.Data.MySQL"));
            }
                                                             , poolSize);

            checksBuilder.AddMySql(connectionString, "IoTSharp.Data.MySQL");
            healthChecksUI.AddMySqlStorage(connectionString);
        }