using Ant.Core.Visitors;
using Ant.Data;
using Ant.Infrastructure;
using Ant.Query;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
namespace Ant.SqlServer
{
class DbContextServiceProvider : IDbContextServiceProvider
{
PagingMode _pagingMode;
public DbContextServiceProvider(PagingMode pagingMode)
{
this._pagingMode = pagingMode;
}
///
/// 创建是SQL2012之前的数据库带分页的
///
///
public IDbExpressionTranslator CreateDbExpressionTranslator()
{
if (_pagingMode == Ant.Data.PagingMode.ROW_NUMBER)
{
return DbExpressionTranslator.Instance;
}
else if (_pagingMode == Ant.Data.PagingMode.OFFSET_FETCH)
{
return DbExpressionTranslator_OffsetFetch.Instance;
}
throw new NotSupportedException();
}
}
}