using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Entity.Infrastructure.Interception;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace XdCxRhDW.Repostory
{
///
/// Sqlite拦截器.
/// contains或indexOf成的CHARINDEX函数在sqlite里面并不支持,需要拦截转换成LIKE语句
///
public class SqliteInterceptor : DbCommandInterceptor
{
private static Regex replaceRegex = new Regex(@"\(CHARINDEX\((.*?),\s?(.*?)\)\)\s*?>\s*?0");
public override void ReaderExecuting(DbCommand command, DbCommandInterceptionContext interceptionContext)
{
ReplaceCharIndexFunc(command);
}
public override void ScalarExecuting(DbCommand command, DbCommandInterceptionContext