INNER CODE UNIT · C#
AdoNetEventStore
daxnet/apworks-core · src/Apworks.EventStore.AdoNet/AdoNetEventStore.cs:15
public abstract class AdoNetEventStore : Events.EventStore
{
private readonly AdoNetEventStoreConfiguration config;
protected AdoNetEventStore(AdoNetEventStoreConfiguration config, IObjectSerializer payloadSerializer)
: base(payloadSerializer)
{
this.config = config;
}
private (string, IEnumerable<IDbDataParameter>) PrepareLoadCommand<TKey>(IDbCommand command, string originatorClrType, TKey originatorId, long sequenceMin, long sequenceMax)
{
// Prepare the SQL statement
var originatorClrTypeParameterName = $"{ParameterChar}{nameof(originatorClrType)}";
var originatorIdParameterName = $"{ParameterChar}{nameof(originatorId)}";
var baseSql = $@"SELECT {this.GetEscapedFieldNames()}
FROM {this.GetEscapedTableName()}
WHERE {this.GetEscapedFieldNames(propertyExpressions: x => x.OriginatorClrType)}={originatorClrTypeParameterName}