diff --git a/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs b/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs index 94fc43d88..5d91055f0 100644 --- a/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs +++ b/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs @@ -56,6 +56,15 @@ public static partial class FreeSqlSqlServerGlobalExtensions static TReturn LocalWithLock(TReturn query, SqlServerLock lockType, Dictionary rule) { var selectProvider = query as Select0Provider; + switch (selectProvider._orm.Ado.DataType) + { + case DataType.SqlServer: + case DataType.OdbcSqlServer: + case DataType.CustomSqlServer: + break; + default: + return query; + } var oldalias = selectProvider._aliasRule; selectProvider._aliasRule = (type, old) => { @@ -93,6 +102,15 @@ static TReturn LocalWithIndex(TReturn query, string indexName, Dictiona { if (string.IsNullOrWhiteSpace(indexName)) return query; var selectProvider = query as Select0Provider; + switch (selectProvider._orm.Ado.DataType) + { + case DataType.SqlServer: + case DataType.OdbcSqlServer: + case DataType.CustomSqlServer: + break; + default: + return query; + } var oldalias = selectProvider._aliasRule; selectProvider._aliasRule = (type, old) => {