mirror of https://github.com/abpframework/abp.git
8 changed files with 124 additions and 6 deletions
@ -0,0 +1,25 @@ |
|||||
|
namespace Volo.Abp.EntityFrameworkCore.DistributedEvents |
||||
|
{ |
||||
|
public class PostgreSqlAdapter : ISqlAdapter |
||||
|
{ |
||||
|
public string NormalizeTableName(string tableName) |
||||
|
{ |
||||
|
return $"\"{tableName}\""; |
||||
|
} |
||||
|
|
||||
|
public string NormalizeColumnName(string columnName) |
||||
|
{ |
||||
|
return $"\"{columnName}\""; |
||||
|
} |
||||
|
|
||||
|
public string NormalizeColumnNameEqualsValue(string columnName, object value) |
||||
|
{ |
||||
|
return $"\"{columnName}\" = '{value}'"; |
||||
|
} |
||||
|
|
||||
|
public string NormalizeValue(object value) |
||||
|
{ |
||||
|
return $"'{value}'"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Volo.Abp.EntityFrameworkCore.DistributedEvents |
||||
|
{ |
||||
|
public class AbpEfCoreDistributedEventBusOptions |
||||
|
{ |
||||
|
public Dictionary<string, ISqlAdapter> SqlAdapters { get; set; } |
||||
|
|
||||
|
public ISqlAdapter GetSqlAdapter(string connectionType) |
||||
|
{ |
||||
|
return SqlAdapters.TryGetValue(connectionType, out var sqlAdapter) ? sqlAdapter : SqlAdapters[DefaultSqlAdapter.Name]; |
||||
|
} |
||||
|
|
||||
|
public AbpEfCoreDistributedEventBusOptions() |
||||
|
{ |
||||
|
SqlAdapters = new Dictionary<string, ISqlAdapter>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
namespace Volo.Abp.EntityFrameworkCore.DistributedEvents |
||||
|
{ |
||||
|
public class DefaultSqlAdapter : ISqlAdapter |
||||
|
{ |
||||
|
public const string Name = "default"; |
||||
|
|
||||
|
public string NormalizeTableName(string tableName) |
||||
|
{ |
||||
|
return tableName; |
||||
|
} |
||||
|
|
||||
|
public string NormalizeColumnName(string columnName) |
||||
|
{ |
||||
|
return columnName; |
||||
|
} |
||||
|
|
||||
|
public string NormalizeColumnNameEqualsValue(string columnName, object value) |
||||
|
{ |
||||
|
return $"{columnName} = '{value}'"; |
||||
|
} |
||||
|
|
||||
|
public string NormalizeValue(object value) |
||||
|
{ |
||||
|
return $"'{value}'"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
namespace Volo.Abp.EntityFrameworkCore.DistributedEvents |
||||
|
{ |
||||
|
public interface ISqlAdapter |
||||
|
{ |
||||
|
string NormalizeTableName(string tableName); |
||||
|
|
||||
|
string NormalizeColumnName(string columnName); |
||||
|
|
||||
|
string NormalizeColumnNameEqualsValue(string columnName, object value); |
||||
|
|
||||
|
string NormalizeValue(object value); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue