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); }
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>(); }
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; }
public Repository(RepositoryOptions options, DataContextOptions dataContextOptions) : this(options, dataContextOptions, null) { }
public DataContext(DataContextOptions options) : this(options, null) { }
private static Microsoft.Extensions.Configuration.IConfiguration GetConfiguration(DataContextOptions options) { #if NETSTANDARD return((options.Configuration ?? ConfigurationFactory.DefaultConfiguration).SystemConfiguration); #else return(null); #endif }
public DataContextAsync(DataContextOptions options, DbTransaction transaction) : base(options, transaction) { }