mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 增加 Oracle DbFirst 视图的支持;
This commit is contained in:
parent
bf84bf0fcb
commit
2d2a0e211e
@ -12,7 +12,7 @@
|
||||
<Description>使用 FreeSql 快速生成数据库的实体类,安装:dotnet tool install -g FreeSql.Generator</Description>
|
||||
<PackageProjectUrl>https://github.com/2881099/FreeSql</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/2881099/FreeSql</RepositoryUrl>
|
||||
<Version>1.9.0-preview0920</Version>
|
||||
<Version>1.8.1.330</Version>
|
||||
<PackageTags>FreeSql DbFirst 实体生成器</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -33,6 +33,8 @@ namespace FreeSql.Tests.Oracle
|
||||
Assert.Equal(t1.Columns.Count, t2.Columns.Count);
|
||||
var t3 = fsql.DbFirst.GetTableByName("notexists_tb");
|
||||
Assert.Null(t3);
|
||||
|
||||
var t4 = fsql.DbFirst.GetTableByName("V_DTOS_DT");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -1,5 +1,6 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using FreeSql.Tests.DataContext.SqlServer;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using NetTaste;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -47,7 +48,14 @@ namespace FreeSql.Tests.SqlServer
|
||||
[Fact]
|
||||
public void ExecuteNonQuery()
|
||||
{
|
||||
|
||||
var ps = new[]
|
||||
{
|
||||
new SqlParameter("@TableName", "tb1"),
|
||||
new SqlParameter("@FInterID", System.Data.SqlDbType.Int)
|
||||
};
|
||||
ps[1].Direction = System.Data.ParameterDirection.Output;
|
||||
g.sqlserver.Ado.ExecuteNonQuery(System.Data.CommandType.StoredProcedure, "dbo.GetICMaxNum", ps);
|
||||
Assert.Equal(100, ps[1].Value);
|
||||
}
|
||||
[Fact]
|
||||
public void ExecuteScalar()
|
||||
|
@ -216,14 +216,27 @@ namespace FreeSql.Odbc.Oracle
|
||||
var databaseIn = string.Join(",", database.Select(a => _commonUtils.FormatSql("{0}", a)));
|
||||
var sql = $@"
|
||||
select
|
||||
a.owner || '.' || a.table_name,
|
||||
a.owner || '.' || a.table_name AS tbname,
|
||||
a.owner,
|
||||
a.table_name,
|
||||
b.comments,
|
||||
'TABLE'
|
||||
'TABLE' AS tp
|
||||
from all_tables a
|
||||
left join all_tab_comments b on b.owner = a.owner and b.table_name = a.table_name and b.table_type = 'TABLE'
|
||||
where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(tbname == null ? "" : $" and {(ignoreCase ? "lower(a.table_name)" : "a.table_name")}={_commonUtils.FormatSql("{0}", tbname[1])}")}";
|
||||
where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(tbname == null ? "" : $" and {(ignoreCase ? "lower(a.table_name)" : "a.table_name")}={_commonUtils.FormatSql("{0}", tbname[1])}")}
|
||||
|
||||
UNION ALL
|
||||
|
||||
select
|
||||
a.owner || '.' || a.view_name,
|
||||
a.owner,
|
||||
a.view_name,
|
||||
b.comments,
|
||||
'VIEW' AS tp
|
||||
from all_views a
|
||||
left join all_tab_comments b on b.owner = a.owner and b.table_name = a.view_name and b.table_type = 'VIEW'
|
||||
where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(tbname == null ? "" : $" and {(ignoreCase ? "lower(a.view_name)" : "a.view_name")}={_commonUtils.FormatSql("{0}", tbname[1])}")}
|
||||
";
|
||||
var ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
|
@ -216,14 +216,27 @@ namespace FreeSql.Oracle
|
||||
var databaseIn = string.Join(",", database.Select(a => _commonUtils.FormatSql("{0}", a)));
|
||||
var sql = $@"
|
||||
select
|
||||
a.owner || '.' || a.table_name,
|
||||
a.owner || '.' || a.table_name AS tbname,
|
||||
a.owner,
|
||||
a.table_name,
|
||||
b.comments,
|
||||
'TABLE'
|
||||
'TABLE' AS tp
|
||||
from all_tables a
|
||||
left join all_tab_comments b on b.owner = a.owner and b.table_name = a.table_name and b.table_type = 'TABLE'
|
||||
where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(tbname == null ? "" : $" and {(ignoreCase ? "lower(a.table_name)" : "a.table_name")}={_commonUtils.FormatSql("{0}", tbname[1])}")}";
|
||||
where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(tbname == null ? "" : $" and {(ignoreCase ? "lower(a.table_name)" : "a.table_name")}={_commonUtils.FormatSql("{0}", tbname[1])}")}
|
||||
|
||||
UNION ALL
|
||||
|
||||
select
|
||||
a.owner || '.' || a.view_name,
|
||||
a.owner,
|
||||
a.view_name,
|
||||
b.comments,
|
||||
'VIEW' AS tp
|
||||
from all_views a
|
||||
left join all_tab_comments b on b.owner = a.owner and b.table_name = a.view_name and b.table_type = 'VIEW'
|
||||
where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(tbname == null ? "" : $" and {(ignoreCase ? "lower(a.view_name)" : "a.view_name")}={_commonUtils.FormatSql("{0}", tbname[1])}")}
|
||||
";
|
||||
var ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||
if (ds == null) return loc1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user