提交 76ed47ae 编写于 作者: s0611163's avatar s0611163

v2.0.4 ISqlString查询接口变更,旧接口标记为Obsolete

上级 cda04481
......@@ -6,9 +6,9 @@
<Nullable>disable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>Dapper.Lite</Title>
<AssemblyVersion>2.0.3</AssemblyVersion>
<FileVersion>2.0.3</FileVersion>
<Version>2.0.3</Version>
<AssemblyVersion>2.0.4</AssemblyVersion>
<FileVersion>2.0.4</FileVersion>
<Version>2.0.4</Version>
<PackageId>Dapper.Lite</PackageId>
<PackageProjectUrl>https://github.com/0611163/Dapper.Lite</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
......@@ -20,7 +20,7 @@
</Description>
<PackageReleaseNotes>
更新内容:
1. 升级Dapper版本
ISqlString查询接口变更,旧接口标记为Obsolete
</PackageReleaseNotes>
</PropertyGroup>
......
......@@ -15,6 +15,7 @@ namespace Dapper.Lite
/// </summary>
public interface ISqlQueryable<T> where T : new()
{
#region 变量
/// <summary>
/// 参数化查询的SQL
/// </summary>
......@@ -29,7 +30,9 @@ namespace Dapper.Lite
/// 参数化查询的参数
/// </summary>
DynamicParameters DynamicParameters { get; }
#endregion
#region Where
/// <summary>
/// 追加参数化SQL
/// </summary>
......@@ -41,17 +44,23 @@ namespace Dapper.Lite
/// </summary>
/// <param name="expression">Lambda 表达式</param>
ISqlQueryable<T> Where<U>(Expression<Func<U, object>> expression);
#endregion
#region OrderBy
/// <summary>
/// 追加 order by SQL
/// </summary>
ISqlQueryable<T> OrderBy(Expression<Func<T, object>> expression);
#endregion
#region OrderByDescending
/// <summary>
/// 追加 order by SQL
/// </summary>
ISqlQueryable<T> OrderByDescending(Expression<Func<T, object>> expression);
#endregion
#region 增删改查接口
/// <summary>
/// 执行查询
/// </summary>
......@@ -83,12 +92,12 @@ namespace Dapper.Lite
Task<long> CountAsync();
/// <summary>
/// 返回数量
/// 返回第一行的值,不存在则返回null
/// </summary>
T First();
/// <summary>
/// 返回数量
/// 返回第一行的值,不存在则返回null
/// </summary>
Task<T> FirstAsync();
......@@ -111,6 +120,7 @@ namespace Dapper.Lite
/// 删除
/// </summary>
Task<int> DeleteAsync();
#endregion
}
}
......@@ -115,6 +115,7 @@ namespace Dapper.Lite
/// </summary>
public interface ISqlString
{
#region 变量
/// <summary>
/// 参数化查询的SQL
/// </summary>
......@@ -129,14 +130,18 @@ namespace Dapper.Lite
/// 参数化查询的参数
/// </summary>
DynamicParameters DynamicParameters { get; }
#endregion
#region Append
/// <summary>
/// 追加参数化SQL
/// </summary>
/// <param name="sql">SQL</param>
/// <param name="args">参数(支持多个参数或者把多个参数放在一个匿名对象中)</param>
ISqlString Append(string sql, params object[] args);
#endregion
#region AppendIf
/// <summary>
/// 追加参数化SQL
/// </summary>
......@@ -144,71 +149,52 @@ namespace Dapper.Lite
/// <param name="sql">SQL</param>
/// <param name="args">参数</param>
ISqlString AppendIf(bool condition, string sql, params object[] args);
#endregion
#region ToSql
/// <summary>
/// 返回SQL语句
/// </summary>
string ToSql();
#endregion
#region ForList
/// <summary>
/// 创建 in 或 not in SQL
/// </summary>
SqlValue ForList(IList list);
#endregion
#region 增删改查接口
/// <summary>
/// 查询实体
/// 返回第一行的值,不存在则返回null
/// </summary>
T Query<T>() where T : new();
T First<T>() where T : new();
/// <summary>
/// 查询实体
/// 返回第一行的值,不存在则返回null
/// </summary>
Task<T> QueryAsync<T>() where T : new();
Task<T> FirstAsync<T>() where T : new();
/// <summary>
/// 查询列表
/// </summary>
List<T> QueryList<T>() where T : new();
List<T> ToList<T>() where T : new();
/// <summary>
/// 查询列表
/// </summary>
Task<List<T>> QueryListAsync<T>() where T : new();
Task<List<T>> ToListAsync<T>() where T : new();
/// <summary>
/// 分页查询
/// </summary>
List<T> QueryPage<T>(string orderby, int pageSize, int currentPage) where T : new();
List<T> ToPageList<T>(string orderby, int pageSize, int currentPage) where T : new();
/// <summary>
/// 分页查询
/// </summary>
Task<List<T>> QueryPageAsync<T>(string orderby, int pageSize, int currentPage) where T : new();
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
int DeleteByCondition<T>();
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
Task<int> DeleteByConditionAsync<T>();
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
int DeleteByCondition(Type type);
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
Task<int> DeleteByConditionAsync(Type type);
Task<List<T>> ToPageListAsync<T>(string orderby, int pageSize, int currentPage) where T : new();
/// <summary>
/// 条件删除
......@@ -291,5 +277,67 @@ namespace Dapper.Lite
Task<CountResult> QueryCountAsync(int pageSize);
#endregion
#region Obsolete 增删改查接口
/// <summary>
/// 查询实体
/// </summary>
[Obsolete]
T Query<T>() where T : new();
/// <summary>
/// 查询实体
/// </summary>
[Obsolete]
Task<T> QueryAsync<T>() where T : new();
/// <summary>
/// 查询列表
/// </summary>
[Obsolete]
List<T> QueryList<T>() where T : new();
/// <summary>
/// 查询列表
/// </summary>
[Obsolete]
Task<List<T>> QueryListAsync<T>() where T : new();
/// <summary>
/// 分页查询
/// </summary>
[Obsolete]
List<T> QueryPage<T>(string orderby, int pageSize, int currentPage) where T : new();
/// <summary>
/// 分页查询
/// </summary>
[Obsolete]
Task<List<T>> QueryPageAsync<T>(string orderby, int pageSize, int currentPage) where T : new();
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
int DeleteByCondition<T>();
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
Task<int> DeleteByConditionAsync<T>();
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
int DeleteByCondition(Type type);
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
Task<int> DeleteByConditionAsync(Type type);
#endregion
}
}
......@@ -262,6 +262,8 @@ namespace Dapper.Lite
}
#endregion
#region 实现增删改查接口
#region ToList
/// <summary>
/// 执行查询
......@@ -326,7 +328,7 @@ namespace Dapper.Lite
#region First
/// <summary>
/// 返回数量
/// 返回第一行的值,不存在则返回null
/// </summary>
public T First()
{
......@@ -334,7 +336,7 @@ namespace Dapper.Lite
}
/// <summary>
/// 返回数量
/// 返回第一行的值,不存在则返回null
/// </summary>
public async Task<T> FirstAsync()
{
......@@ -412,6 +414,8 @@ namespace Dapper.Lite
return _session.DeleteByConditionAsync<T>(right, this.Params);
}
#endregion
#endregion
}
......
......@@ -623,17 +623,17 @@ namespace Dapper.Lite
#region 实现ISqlString增删改查接口
/// <summary>
/// 查询实体
/// 返回第一行的值,不存在则返回null
/// </summary>
public T Query<T>() where T : new()
public T First<T>() where T : new()
{
return _session.Query<T>(this);
}
/// <summary>
/// 查询实体
/// 返回第一行的值,不存在则返回null
/// </summary>
public Task<T> QueryAsync<T>() where T : new()
public Task<T> FirstAsync<T>() where T : new()
{
return _session.QueryAsync<T>(this);
}
......@@ -641,7 +641,7 @@ namespace Dapper.Lite
/// <summary>
/// 查询列表
/// </summary>
public List<T> QueryList<T>() where T : new()
public List<T> ToList<T>() where T : new()
{
return _session.QueryList<T>(this);
}
......@@ -649,7 +649,7 @@ namespace Dapper.Lite
/// <summary>
/// 查询列表
/// </summary>
public Task<List<T>> QueryListAsync<T>() where T : new()
public Task<List<T>> ToListAsync<T>() where T : new()
{
return _session.QueryListAsync<T>(this);
}
......@@ -657,7 +657,7 @@ namespace Dapper.Lite
/// <summary>
/// 分页查询
/// </summary>
public List<T> QueryPage<T>(string orderby, int pageSize, int currentPage) where T : new()
public List<T> ToPageList<T>(string orderby, int pageSize, int currentPage) where T : new()
{
return _session.QueryPage<T>(this, orderby, pageSize, currentPage);
}
......@@ -665,47 +665,11 @@ namespace Dapper.Lite
/// <summary>
/// 分页查询
/// </summary>
public Task<List<T>> QueryPageAsync<T>(string orderby, int pageSize, int currentPage) where T : new()
public Task<List<T>> ToPageListAsync<T>(string orderby, int pageSize, int currentPage) where T : new()
{
return _session.QueryPageAsync<T>(this, orderby, pageSize, currentPage);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public int DeleteByCondition<T>()
{
return _session.DeleteByCondition<T>(this);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public Task<int> DeleteByConditionAsync<T>()
{
return _session.DeleteByConditionAsync<T>(this);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public int DeleteByCondition(Type type)
{
return _session.DeleteByCondition(type, this);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public Task<int> DeleteByConditionAsync(Type type)
{
return _session.DeleteByConditionAsync(type, this);
}
/// <summary>
/// 条件删除
/// </summary>
......@@ -836,5 +800,97 @@ namespace Dapper.Lite
#endregion
#region Obsolete 增删改查接口
/// <summary>
/// 查询实体
/// </summary>
[Obsolete]
public T Query<T>() where T : new()
{
return _session.Query<T>(this);
}
/// <summary>
/// 查询实体
/// </summary>
[Obsolete]
public Task<T> QueryAsync<T>() where T : new()
{
return _session.QueryAsync<T>(this);
}
/// <summary>
/// 查询列表
/// </summary>
[Obsolete]
public List<T> QueryList<T>() where T : new()
{
return _session.QueryList<T>(this);
}
/// <summary>
/// 查询列表
/// </summary>
[Obsolete]
public Task<List<T>> QueryListAsync<T>() where T : new()
{
return _session.QueryListAsync<T>(this);
}
/// <summary>
/// 分页查询
/// </summary>
[Obsolete]
public List<T> QueryPage<T>(string orderby, int pageSize, int currentPage) where T : new()
{
return _session.QueryPage<T>(this, orderby, pageSize, currentPage);
}
/// <summary>
/// 分页查询
/// </summary>
[Obsolete]
public Task<List<T>> QueryPageAsync<T>(string orderby, int pageSize, int currentPage) where T : new()
{
return _session.QueryPageAsync<T>(this, orderby, pageSize, currentPage);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public int DeleteByCondition<T>()
{
return _session.DeleteByCondition<T>(this);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public Task<int> DeleteByConditionAsync<T>()
{
return _session.DeleteByConditionAsync<T>(this);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public int DeleteByCondition(Type type)
{
return _session.DeleteByCondition(type, this);
}
/// <summary>
/// 条件删除
/// </summary>
[Obsolete]
public Task<int> DeleteByConditionAsync(Type type)
{
return _session.DeleteByConditionAsync(type, this);
}
#endregion
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册