Browse Source

Add AsType

pull/23/MERGE
sunkaixuan 2 years ago
parent
commit
94d940bae5
  1. 4
      Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs
  2. 4
      Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs
  3. 4
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs
  4. 4
      Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs
  5. 1
      Src/Asp.Net/SqlSugar/Interface/IDeleteable.cs
  6. 1
      Src/Asp.Net/SqlSugar/Interface/IQueryable.cs
  7. 1
      Src/Asp.Net/SqlSugar/Interface/IUpdateable.cs
  8. 1
      Src/Asp.Net/SqlSugar/Interface/Insertable.cs

4
Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs

@ -61,6 +61,10 @@ namespace SqlSugar
{
return await ExecuteCommandAsync() > 0;
}
public IDeleteable<T> AsType(Type tableNameType)
{
return AS(this.Context.EntityMaintenance.GetEntityInfo(tableNameType).DbTableName);
}
public IDeleteable<T> AS(string tableName)
{
if (tableName == null) return this;

4
Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs

@ -375,6 +375,10 @@ namespace SqlSugar
result.Inserable = this;
return result;
}
public IInsertable<T> AsType(Type tableNameType)
{
return AS(this.Context.EntityMaintenance.GetEntityInfo(tableNameType).DbTableName);
}
public IInsertable<T> AS(string tableName)
{
if (tableName == null) return this;

4
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -196,6 +196,10 @@ namespace SqlSugar
var entityName = typeof(T).Name;
return _As(tableName, entityName);
}
public ISugarQueryable<T> AsType(Type tableNameType)
{
return AS(this.Context.EntityMaintenance.GetEntityInfo(tableNameType).DbTableName);
}
public virtual ISugarQueryable<T> With(string withString)
{
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)

4
Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

@ -184,6 +184,10 @@ namespace SqlSugar
this.IsVersionValidation = true;
return this;
}
public IUpdateable<T> AsType(Type tableNameType)
{
return AS(this.Context.EntityMaintenance.GetEntityInfo(tableNameType).DbTableName);
}
public IUpdateable<T> AS(string tableName)
{
if (tableName == null) return this;

1
Src/Asp.Net/SqlSugar/Interface/IDeleteable.cs

@ -15,6 +15,7 @@ namespace SqlSugar
Task<int> ExecuteCommandAsync();
Task<bool> ExecuteCommandHasChangeAsync();
IDeleteable<T> AS(string tableName);
IDeleteable<T> AsType(Type tableNameType);
IDeleteable<T> With(string lockString);
IDeleteable<T> Where(T deleteObj);
IDeleteable<T> Where(Expression<Func<T, bool>> expression);

1
Src/Asp.Net/SqlSugar/Interface/IQueryable.cs

@ -18,6 +18,7 @@ namespace SqlSugar
ISugarQueryable<T> Clone();
ISugarQueryable<T> AS<T2>(string tableName);
ISugarQueryable<T> AS(string tableName);
ISugarQueryable<T> AsType(Type tableNameType);
ISugarQueryable<T> With(string withString);
//ISugarQueryable<T> CrossQueryWithAttr();
ISugarQueryable<T> CrossQuery<Type>(string configId);

1
Src/Asp.Net/SqlSugar/Interface/IUpdateable.cs

@ -21,6 +21,7 @@ namespace SqlSugar
IUpdateable<T> AS(string tableName);
IUpdateable<T> AsType(Type tableNameType);
IUpdateable<T> With(string lockString);

1
Src/Asp.Net/SqlSugar/Interface/Insertable.cs

@ -26,6 +26,7 @@ namespace SqlSugar
long ExecuteReturnBigIdentity();
Task<long> ExecuteReturnBigIdentityAsync();
IInsertable<T> AS(string tableName);
IInsertable<T> AsType(Type tableNameType);
IInsertable<T> With(string lockString);
IInsertable<T> InsertColumns(Expression<Func<T, object>> columns);
IInsertable<T> InsertColumns(params string[] columns);

Loading…
Cancel
Save