From e7be95e6aadd6872b7d01a04abdc872c0438ce6d Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Sat, 16 Mar 2019 22:10:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=20ManyToMany=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql/SqlServer/SqlServerDbFirst.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/FreeSql/SqlServer/SqlServerDbFirst.cs b/FreeSql/SqlServer/SqlServerDbFirst.cs index 9544e6ef..f7005a06 100644 --- a/FreeSql/SqlServer/SqlServerDbFirst.cs +++ b/FreeSql/SqlServer/SqlServerDbFirst.cs @@ -118,7 +118,7 @@ namespace FreeSql.SqlServer { var loc3 = new Dictionary>(); var sql = $@" -use {db}; +use [{db}]; select a.Object_id ,b.name 'Owner' @@ -146,7 +146,7 @@ inner join sys.schemas b on b.schema_id = a.schema_id where a.type = 'P' and charindex('$NPSP', a.name) = 0 and charindex('diagram', a.name) = 0 order by type desc, b.name, a.name ; -use {olddatabase}; +use [{olddatabase}]; "; var ds = _orm.Ado.ExecuteArray(CommandType.Text, sql); if (ds == null) return loc1; @@ -213,7 +213,7 @@ from sys.columns", loc8); ,a.is_output 'IsIdentity' from sys.parameters", loc88); } - sql = $"use {db};{sql};use {olddatabase}; "; + sql = $"use [{db}];{sql};use [{olddatabase}]; "; ds = _orm.Ado.ExecuteArray(CommandType.Text, sql); if (ds == null) return loc1; @@ -245,7 +245,7 @@ from sys.parameters", loc88); } sql = $@" -use {db}; +use [{db}]; select a.object_id 'Object_id' ,c.name 'Column' @@ -259,7 +259,7 @@ inner join sys.indexes b on b.object_id = a.object_id and b.index_id = a.index_i left join sys.columns c on c.object_id = a.object_id and c.column_id = a.column_id where a.object_id in ({loc8}) ; -use {olddatabase}; +use [{olddatabase}]; "; ds = _orm.Ado.ExecuteArray(CommandType.Text, sql); if (ds == null) return loc1; @@ -306,7 +306,7 @@ use {olddatabase}; } sql = $@" -use {db}; +use [{db}]; select b.object_id 'Object_id' ,c.name 'Column' @@ -322,7 +322,7 @@ inner join sys.columns c on c.object_id = a.parent_object_id and c.column_id = a inner join sys.columns d on d.object_id = a.referenced_object_id and d.column_id = a.referenced_column_id where b.object_id in ({loc8}) ; -use {olddatabase}; +use [{olddatabase}]; "; ds = _orm.Ado.ExecuteArray(CommandType.Text, sql); if (ds == null) return loc1;