public static IServiceCollection AddDapper(this IServiceCollection services, Action <DapperOptions> options)
        {
            if (services.IsRegistered(typeof(IDapperRepository)))
            {
                return(services);
            }


            var internalOptions = new DapperOptions();

            services.AddTransient <DapperOptions>(a => internalOptions);

            options(internalOptions);

            switch (internalOptions.DbType)
            {
            case DapperDbType.Sqlite:
            case DapperDbType.Oracle:
                throw new Exception("Not implemented dbtype");

            case DapperDbType.Postgre:
                services.AddTransient <IDapperProvider, DapperPostgreProvider>();
                break;

            default:
                services.AddTransient <IDapperProvider, DapperSqlServerProvider>();
                break;
            }


            return(services);
        }
 public static DapperOptions UseMySql(this DapperOptions options, string connectionString, int?timeout = null)
 {
     options.DbType       = DbType.MySql;
     options.SqlDialect   = new MySqlDialect();
     options.DbConnection = () => new MySqlConnection(connectionString);
     options.Timeout      = null;
     return(options);
 }