public static ISqlParser NewInstance(string dataSourceName, string sql) { var sqlParserConfigurations = NewInstanceServiceLoader.NewServiceInstances <ISqlParserConfiguration>(); foreach (var configuration in sqlParserConfigurations) { if (configuration.GetDataSourceName().Equals(dataSourceName)) { return(CreateSqlParser(sql, configuration)); } } throw new NotSupportedException($"Cannot support database type '{dataSourceName}'"); }
static SqlParserFactory() { NewInstanceServiceLoader.Register <ISqlParserConfiguration>(); }
static ShardingKeyGeneratorServiceLoader() { NewInstanceServiceLoader.Register <IShardingKeyGenerator>(); }