Exemplo n.º 1
0
        public static SmartSqlBuilder UseOracleCommandExecuter(this SmartSqlBuilder smartSqlBuilder,
                                                               ILoggerFactory loggerFactory)
        {
            var cmdExe = new CommandExecuter(loggerFactory.CreateLogger <CommandExecuter>());

            cmdExe.DbCommandCreated += OnDbCommandCreated;
            smartSqlBuilder.UseCommandExecuter(cmdExe);
            return(smartSqlBuilder);
        }
Exemplo n.º 2
0
        public bool TryRegister(string alias, SmartSqlBuilder smartSqlBuilder)
        {
            if (alias == null)
            {
                throw new ArgumentNullException(nameof(alias));
            }

            return(Container.TryAdd(alias, smartSqlBuilder));
        }
Exemplo n.º 3
0
 public void Register(SmartSqlBuilder smartSqlBuilder)
 {
     lock (this)
     {
         if (Container.ContainsKey(smartSqlBuilder.Alias))
         {
             throw new SmartSqlException($"SmartSql.Alias:[{smartSqlBuilder.Alias}] already exist.");
         }
         Container.Add(smartSqlBuilder.Alias, smartSqlBuilder);
     }
 }
Exemplo n.º 4
0
        public static SmartSqlBuilder UseOptions(this SmartSqlBuilder builder
                                                 , IServiceProvider serviceProvider)
        {
            var configOptions = serviceProvider
                                .GetRequiredService <IOptionsSnapshot <SmartSqlConfigOptions> >()
                                .Get(builder.Alias);
            var loggerFactory = serviceProvider.GetService <ILoggerFactory>();
            var configBuilder = new OptionConfigBuilder(configOptions, loggerFactory);

            builder.UseConfigBuilder(configBuilder);
            return(builder);
        }
Exemplo n.º 5
0
 public static SmartSqlBuilder UseOracleCommandExecuter(this SmartSqlBuilder smartSqlBuilder)
 {
     return(UseOracleCommandExecuter(smartSqlBuilder, smartSqlBuilder.LoggerFactory));
 }
Exemplo n.º 6
0
 public bool TryRegister(SmartSqlBuilder smartSqlBuilder)
 {
     return(Container.TryAdd(smartSqlBuilder.Alias, smartSqlBuilder));
 }
 public static SmartSqlBuilder UseProperties(this SmartSqlBuilder smartSqlBuilder, IConfiguration configuration)
 {
     return(smartSqlBuilder.UseProperties(configuration.AsEnumerable()));
 }