Exemplo n.º 1
0
 public TestController(
     ILogger loggerParam,
     ISqlConfiguration configParam,
     IDapperClient dapperClientParam)
 {
     this.logger       = loggerParam ?? throw new ArgumentNullException(nameof(loggerParam));
     this.config       = configParam ?? throw new ArgumentNullException(nameof(configParam));
     this.dapperClient = dapperClientParam ?? throw new ArgumentNullException(nameof(dapperClientParam));
 }
Exemplo n.º 2
0
        public DapperClient(
            ISqlConfiguration configParam,
            ILogger loggerParam)
        {
            var config = configParam ?? throw new ArgumentNullException(nameof(configParam));

            this.logger = loggerParam ?? throw new ArgumentNullException(nameof(loggerParam));

            var connectionString =
                $"Server={ config.Server };" +
                $"Initial Catalog={ config.InitialCatalog };" +
                $"Integrated Security={ config.IntegratedSecurity };" +
                $"MultipleActiveResultSets={ config.MultipleActiveResultSets };";

            this.logger.Verbose($"Setting up DB Connection with connection string: { connectionString }");
            this.connection = new SqlConnection(connectionString);
        }
Exemplo n.º 3
0
 public SqlRepository(ISqlConfiguration configuration)
 {
     _configuration = configuration;
 }
Exemplo n.º 4
0
 public OrderRepository(ISqlConfiguration sqlConfiguration)
 {
     _sqlConfiguration = sqlConfiguration;
 }
Exemplo n.º 5
0
 public SqlRepository(ISqlConfiguration sqlConfiguration)
 {
     _sqlConfiguration = sqlConfiguration;
     _dbConnection     = new SqlConnection(_sqlConfiguration.ConnectionString);
 }