Ejemplo n.º 1
0
 public RepositoryAsync(RepositoryOptions options, DataContextOptions dataContextOptions, DbTransaction transaction)
     : base(options, dataContextOptions, transaction)
 {
     _options = options;
     dataContextOptions.ConnectionName = dataContextOptions.ConnectionName ?? options.Configuration?.DefaultConnectionName;
     _context = new DataContextAsync(dataContextOptions, transaction);
 }
Ejemplo n.º 2
0
        public Repository(RepositoryOptions options, DataContextOptions dataContextOptions, DbTransaction transaction)
        {
            var configuration = options.Configuration ?? dataContextOptions.Configuration;

            options.Configuration            = configuration;
            dataContextOptions.Configuration = configuration;

            _options = options;
            dataContextOptions.ConnectionName = dataContextOptions.ConnectionName ?? options.Configuration?.DefaultConnectionName;
            _context    = new DataContext(dataContextOptions, transaction);
            _configured = new HashSet <Type>();
        }
Ejemplo n.º 3
0
 public DataContext(DataContextOptions options, DbTransaction transaction)
 {
     Options     = options;
     Transaction = transaction;
     if (transaction != null)
     {
         Session = transaction.Connection;
     }
     else if (options?.ConnectionName != null)
     {
         Session = DbFactory.CreateConnection(options.ConnectionName, GetConfiguration(options));
     }
     else if (options?.ConnectionString != null)
     {
         Session = DbFactory.CreateConnection(options.ConnectionString, DbFactory.GetProviderInvariantNameByConnectionString(options.ConnectionString, GetConfiguration(options)));
     }
     else
     {
         Session = DbFactory.CreateConnection(ConfigurationFactory.DefaultConnectionName, GetConfiguration(options));
     }
     Source = Session?.ConnectionString;
 }
Ejemplo n.º 4
0
 public Repository(RepositoryOptions options, DataContextOptions dataContextOptions)
     : this(options, dataContextOptions, null)
 {
 }
Ejemplo n.º 5
0
 public DataContext(DataContextOptions options)
     : this(options, null)
 {
 }
Ejemplo n.º 6
0
        private static Microsoft.Extensions.Configuration.IConfiguration GetConfiguration(DataContextOptions options)
        {
#if NETSTANDARD
            return((options.Configuration ?? ConfigurationFactory.DefaultConfiguration).SystemConfiguration);
#else
            return(null);
#endif
        }
Ejemplo n.º 7
0
 public DataContextAsync(DataContextOptions options, DbTransaction transaction)
     : base(options, transaction)
 {
 }