mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 10:24:44 +08:00
增加对sql只返回string的支持;
修复添加表单时,如果关联的数据库已存在的bug
This commit is contained in:
@@ -77,6 +77,7 @@ namespace OpenAuth.Repository
|
||||
modelBuilder.Entity<DataPrivilegeRule>()
|
||||
.HasKey(c => new { c.Id });
|
||||
modelBuilder.Entity<SysTableColumn>().HasNoKey();
|
||||
modelBuilder.Entity<QueryStringObj>().HasNoKey();
|
||||
}
|
||||
|
||||
public virtual DbSet<Application> Applications { get; set; }
|
||||
@@ -110,6 +111,7 @@ namespace OpenAuth.Repository
|
||||
public virtual DbSet<BuilderTable> BuilderTables { get; set; }
|
||||
public virtual DbSet<BuilderTableColumn> BuilderTableColumns { get; set; }
|
||||
//非数据库表格
|
||||
public virtual DbSet<QueryStringObj> QueryStringObjs { get; set; }
|
||||
public virtual DbSet<SysTableColumn> SysTableColumns { get; set; }
|
||||
|
||||
}
|
||||
|
||||
11
OpenAuth.Repository/QueryObj/QueryStringObj.cs
Normal file
11
OpenAuth.Repository/QueryObj/QueryStringObj.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace OpenAuth.Repository.QueryObj
|
||||
{
|
||||
/// <summary>
|
||||
/// 针对只返回字符串类型的数值。查询SQL必需使用Value作为返回字段
|
||||
/// 因为string没有构造函数,不能作为DbSet/DbQuery泛型的参数
|
||||
/// </summary>
|
||||
public class QueryStringObj
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,7 @@ namespace OpenAuth.Repository
|
||||
|
||||
public int ExecuteSql(string sql)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return 0;
|
||||
return _context.Database.ExecuteSqlRaw(sql);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user