public DapperSessionFactory(IDapperConfiguration configuration, ILogger <DapperSessionFactory> logger, IConnectionStringProvider connectionStringProvider) { _connectionStringProvider = connectionStringProvider; _configuration = configuration; _logger = logger; _loadedContexts = new Lazy <ConcurrentDictionary <Type, string> >(() => GetAllLoadedContexts()); }
public DapperRepositoryBase(IDapperConfiguration configuration) { Configurationn = configuration; WriteConnection = new MySqlConnection(Configurationn.WriteConnectionString); ReadConnection = new MySqlConnection(Configurationn.ReadConnectionString); Connection = new DapperConnection(WriteConnection, ReadConnection); }
private DapperConfiguration() { ContainerCustomisations = new ContainerCustomisations(); Providers = new Dictionary <string, IConnectionStringProvider>(); Assemblies = new List <Assembly>(); DefaultConnectionStringName = "__Default"; Instance = null; }
public DapperRepositoryBase(IDapperConfiguration configuration, bool IsOriginalTableName) { Configurationn = configuration; WriteConnection = new MySqlConnection(Configurationn.WriteConnectionString); ReadConnection = new MySqlConnection(Configurationn.ReadConnectionString); SqlMapperExtensions.IsOriginalTableName = IsOriginalTableName; Connection = new DapperConnection(WriteConnection, ReadConnection); }
public DapperSessionContext(IDapperSessionFactory factory, IDapperConfiguration configuration, ILogger <DapperSessionContext> logger) { _factory = factory; _logger = logger; _configuration = configuration; IsolationLevel = IsolationLevel.ReadCommitted; _sessionMap = new Lazy <ConcurrentDictionary <string, IDapperSession> >(() => new ConcurrentDictionary <string, IDapperSession>()); }
/// <summary> /// Creates a new session factory. /// </summary> /// <param name="conString">The connection string to the sql server database.</param> /// <param name="configuration">The dapper configuration to use.</param> public SessionFactory(string conString, IDapperConfiguration configuration) { Guard.ArgumentNotNull(configuration, nameof(configuration)); Guard.ArgumentNotNullOrEmptyOrWhiteSpace(conString, nameof(conString)); _conString = conString; Configuration = configuration; }
internal Session(SqlConnection connection, IDapperConfiguration config) { _connection = connection; // TODO: durable open _connection.Open(); Configuration = config; }
/// <summary> /// 获取Sql生成器 /// </summary> /// <returns></returns> public ISqlGenerator GetSqlGenerator() { if (_config == null) { _config = new DapperConfiguration(_mappingAssemblies, _dialect); } var sqlGeneratorImpl = new SqlGeneratorImpl(_config); return(sqlGeneratorImpl); }
protected virtual IClassMapper GetClassMapper(Type type, IDapperConfiguration configuration) { var map = configuration.GetMap(type); if (map == null) { throw new NullReferenceException(string.Format("Map was not found for {0}", type)); } return(map); }
public void Build() { if (Dialect == null) { throw new NullReferenceException("SqlDialect has not been set. Call UseSqlDialect()."); } if (Providers.Any() == false) { UsingConnectionProvider <StaticConnectionStringProvider>(DefaultConnectionStringName); } _container.Build(this); Instance = this; }
static UnitOfWorkManagesTransactionsStoryBase() { // can only be configured once per entity _config = DapperConfiguration .Use() .UseSqlDialect(new SqlServerDialect()); var classMapper = new CustomEntityMap <TestEntity>(); classMapper.SetIdentityGenerated(m => m.Id); var classMappers = new List <IClassMapper> { classMapper }; classMappers.Each(n => _config.Register(n)); }
protected void AndGivenADapperConfiguration() { // instance be application scope _config = DapperConfiguration .Use() .UseSqlDialect(new SqlServerDialect()); var classMapper = new CustomEntityMap <MyEntity>(); classMapper.SetIdentityGenerated(m => m.Id); var classMappers = new List <IClassMapper> { classMapper }; classMappers.Each(n => _config.Register(n)); }
public TestRepository(IDapperConfiguration configuration) : base(configuration) { }
public PeopleReporitory(IDapperConfiguration configuration) : base(configuration) { }
public AddressInfoRepository(IDapperConfiguration configuration) : base(configuration, true) { }
public Repository(IDapperConfiguration configuration) { ConnectionString = configuration?.ConnectionString; Context = new EFContext(ConnectionString); }
public SqlGeneratorImpl(IDapperConfiguration configuration, ILogger <SqlGeneratorImpl> logger) { _logger = logger; Configuration = configuration; }
public UsersRepository(IDapperConfiguration configuration) : base(configuration, true) { }
public RepositoryBase(IDapperConfiguration configuration) { Configuration = configuration; WriteConnection = new MySqlConnection(configuration.WriteConnectionString); ReadConnection = new MySqlConnection(configuration.ReadConnectionStrign); }
public static IDapperConfiguration UseMapper <TMapper>(this IDapperConfiguration configuration) where TMapper : IEntityMapper => configuration.UseMapper(typeof(TMapper));
public MachineryInfoRepository(IDapperConfiguration configuration) : base(configuration, true) { }
public UserRepository(IDapperConfiguration configuration) : base(configuration) { }
public ImportRepository(IDapperConfiguration configuration) : base(configuration, true) { }
public BasicConfigurationRepository(IDapperConfiguration configuration) : base(configuration, true) { }
public AccountInfoRepositories(IDapperConfiguration configuration) : base(configuration) { }
public ShoppingRepository(IDapperConfiguration configuration) : base(configuration, true) { }
public SqlGeneratorImpl(IDapperConfiguration configuration) { Configuration = configuration; }
public StaticConnectionStringProvider(IDapperConfiguration dapperConfiguration) { _dapperConfiguration = dapperConfiguration; }
public MaintenanceInfoRepository(IDapperConfiguration configuration) : base(configuration, true) { }