- 修复 SqlServer DbFirst、CodeFirst 查询实体表的列信息错误,当设置了表/列多个扩展属性时发生;

- 修复 SqlServer2005 CodeFirst 迁移时,不支持 SET (LOCK_ESCALATION TABLE) 的错误(已做适配);
- 修复 SqlServer2005 批量插入SQL语法错误,不支持 Values(),()(已做适配);
- 完善 SqlServer2005 环境跑通了所有单元测试;
This commit is contained in:
28810
2019-11-19 00:38:34 +08:00
parent acd406164a
commit d6010b4b51
34 changed files with 598 additions and 480 deletions

View File

@ -130,32 +130,29 @@ select
a.Object_id
,b.name 'Owner'
,a.name 'Name'
,c.value
,(select value from sys.extended_properties where major_id = a.object_id AND minor_id = 0 AND name = 'MS_Description') 'Comment'
,'TABLE' type
from sys.tables a
inner join sys.schemas b on b.schema_id = a.schema_id
left join sys.extended_properties AS c ON c.major_id = a.object_id AND c.minor_id = 0 AND c.name = 'MS_Description'
where not(b.name = 'dbo' and a.name = 'sysdiagrams')
union all
select
a.Object_id
,b.name 'Owner'
,a.name 'Name'
,c.value
,(select value from sys.extended_properties where major_id = a.object_id AND minor_id = 0 AND name = 'MS_Description') 'Comment'
,'VIEW' type
from sys.views a
inner join sys.schemas b on b.schema_id = a.schema_id
left join sys.extended_properties AS c ON c.major_id = a.object_id AND c.minor_id = 0 AND c.name = 'MS_Description'
union all
select
a.Object_id
,b.name 'Owner'
,a.name 'Name'
,c.value
,(select value from sys.extended_properties where major_id = a.object_id AND minor_id = 0 AND name = 'MS_Description') 'Comment'
,'StoreProcedure' type
from sys.procedures a
inner join sys.schemas b on b.schema_id = a.schema_id
left join sys.extended_properties AS c ON c.major_id = a.object_id AND c.minor_id = 0 AND c.name = 'MS_Description'
where a.type = 'P' and charindex('diagram', a.name) = 0
order by type desc, b.name, a.name
;
@ -241,10 +238,9 @@ isnull(e.name,'') + '.' + isnull(d.name,'')
else cast(a.max_length as varchar) end + ')'
when b.name in ('Numeric', 'Decimal') then '(' + cast(a.precision as varchar) + ',' + cast(a.scale as varchar) + ')'
else '' end as 'SqlType'
,c.value
,(select value from sys.extended_properties where major_id = a.object_id AND minor_id = a.column_id AND name = 'MS_Description') 'Comment'
{0} a
inner join sys.types b on b.user_type_id = a.user_type_id
left join sys.extended_properties AS c ON c.major_id = a.object_id AND c.minor_id = a.column_id
left join sys.tables d on d.object_id = a.object_id
left join sys.schemas e on e.schema_id = d.schema_id
where {1}
@ -257,8 +253,8 @@ from sys.columns", loc8.ToString().Replace("a.table_name", "a.object_id"));
{
sql += "union all" +
string.Format(tsql_place.Replace(
"left join sys.extended_properties AS c ON c.major_id = a.object_id AND c.minor_id = a.column_id",
"left join sys.extended_properties AS c ON c.major_id = a.object_id AND c.minor_id = a.parameter_id"), @"
"select value from sys.extended_properties where major_id = a.object_id AND minor_id = a.column_id",
"select value from sys.extended_properties where major_id = a.object_id AND minor_id = a.parameter_id"), @"
,cast(0 as bit) 'IsNullable'
,a.is_output 'IsIdentity'
from sys.parameters", loc88.ToString().Replace("a.table_name", "a.object_id"));