public Repository() { DommelMapper.SetTableNameResolver(new DefaultTableNameResolver()); DommelMapper.SetKeyPropertyResolver(new DefaultKeyPropertyResolver()); DommelMapper.SetColumnNameResolver(new DefaultColumnNameResolver()); DommelMapper.SetPropertyResolver(new DefaultPropertyResolver()); DommelMapper.SetForeignKeyPropertyResolver(new DefaultForeignKeyPropertyResolver()); }
/// <summary> /// Configures the specified configuration for Dapper.FluentMap.Dommel. /// </summary> /// <param name="config">The Dapper.FluentMap configuration.</param> /// <returns>The Dapper.FluentMap configuration.</returns> public static FluentMapConfiguration ForDommel(this FluentMapConfiguration config) { DommelMapper.SetColumnNameResolver(new DommelColumnNameResolver()); DommelMapper.SetKeyPropertyResolver(new DommelKeyPropertyResolver()); DommelMapper.SetTableNameResolver(new DommelTableNameResolver()); DommelMapper.SetPropertyResolver(new DommelPropertyResolver()); return(config); }
public RuntimeInitializer DefaultMapper(Type type) { DapperExtensions.DapperExtensions.DefaultMapper = type; DommelMapper.SetTableNameResolver(new TableNameResolver()); DommelMapper.SetKeyPropertyResolver(new KeyPropertyResolver()); DommelMapper.SetColumnNameResolver(new ColumnNameResolver()); return(this); }
private void InitializeEntityMappings() { FluentMapper.Initialize(config => { config.ForDommel(); DommelMapper.SetKeyPropertyResolver(new PrimaryKeyResolver()); DommelMapper.SetTableNameResolver(new TableNameResolver()); }); }
public long GetList_Count(Expression <Func <T, bool> > filter = null) { _tableName = typeof(T).Name; using (var connection = CreateConnection()) { DommelMapper.SetTableNameResolver(new CustomTableNameResolver()); return(filter == null ? connection.QueryFirstOrDefault <long>($"SELECT COUNT(1) FROM {_tableName}") : connection.Count <T>(filter)); } }
public IEnumerable <T> GetList(Expression <Func <T, bool> > filter = null) { _tableName = typeof(T).Name; using (var connection = CreateConnection()) { DommelMapper.SetTableNameResolver(new CustomTableNameResolver()); return(filter == null ? connection.Query <T>($"SELECT * FROM {_tableName}") : connection.Select(filter)); } }
public static void Configure() { DommelMapper.SetTableNameResolver(new UnderscoreTableNameResolver()); DommelMapper.SetColumnNameResolver(new UnderscoreColumnNameResolver()); DefaultTypeMap.MatchNamesWithUnderscores = true; }
public Startup(IConfiguration configuration) { DommelMapper.SetTableNameResolver(new DommelTableNameResolver()); Configuration = configuration; StaticConfig = configuration; }
public Startup(IConfiguration configuration) { this.Configuration = configuration; DommelMapper.SetTableNameResolver(new CustomTableNameResolver()); }
/// <summary> /// 自定义相关解析注入 /// </summary> static DapperExtensions() { DommelMapper.SetTableNameResolver(new CustomTableNameResolver()); //TableName DommelMapper.SetKeyPropertyResolver(new CustomKeyPropertyResolver()); //Key }