Skip to content

Commit efd127e

Browse files
authored
Revert "Bumping SMO to v180 (#2531)" (#2540)
This reverts commit 6c3b8e8.
1 parent fa34c85 commit efd127e

File tree

10 files changed

+153
-197
lines changed

10 files changed

+153
-197
lines changed

Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<ItemGroup>
6767
<PackageReference Update="Azure.Identity" Version="1.12.0" />
6868
<PackageReference Update="Microsoft.Data.SqlClient" Version="5.1.7" />
69-
<PackageReference Update="Microsoft.SqlServer.SqlManagementObjects" Version="180.10.0" />
69+
<PackageReference Update="Microsoft.SqlServer.SqlManagementObjects" Version="172.64.0" />
7070
<PackageReference Update="Newtonsoft.Json" Version="13.0.3" />
7171
</ItemGroup>
7272

src/Microsoft.SqlTools.ServiceLayer/Agent/AgentService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ internal async Task HandleJobHistoryRequest(AgentJobHistoryParams parameters, Re
223223
result.Steps = jobSteps.ToArray();
224224

225225
// Add schedules to the job if any
226-
JobScheduleCollection<Job> schedules = jobs[parameters.JobName].JobSchedules;
226+
JobScheduleCollection schedules = jobs[parameters.JobName].JobSchedules;
227227
var jobSchedules = new List<AgentScheduleInfo>();
228228
foreach (JobSchedule schedule in schedules)
229229
{
@@ -1480,7 +1480,7 @@ string targetDatabase
14801480
result.Steps = jobSteps.ToArray();
14811481

14821482
// add schedules to the job if any
1483-
JobScheduleCollection<Job> schedules = jobs[jobName].JobSchedules;
1483+
JobScheduleCollection schedules = jobs[jobName].JobSchedules;
14841484
var jobSchedules = new List<AgentScheduleInfo>();
14851485
foreach (JobSchedule schedule in schedules)
14861486
{

src/Microsoft.SqlTools.ServiceLayer/Agent/Jobs/JobSchedulesData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private void LoadData()
149149
// load the data
150150
if (job != null)
151151
{
152-
JobScheduleCollection<Job> schedules = job.JobSchedules;
152+
JobScheduleCollection schedules = job.JobSchedules;
153153

154154
for (int i = 0; i < schedules.Count; i++)
155155
{

src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoCollectionWrapper.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel
1313
/// <summary>
1414
/// Wrapper to convert non-generic Smo enumerables to generic enumerable types for easier use in
1515
/// </summary>
16-
/// <typeparam name="TObject"></typeparam>
17-
/// <typeparam name="TParent"></typeparam>
18-
public class SmoCollectionWrapper<TObject, TParent> : IEnumerable<TObject>
19-
where TObject : SqlSmoObject
20-
where TParent : SqlSmoObject
16+
/// <typeparam name="T"></typeparam>
17+
public class SmoCollectionWrapper<T> : IEnumerable<T>
18+
where T : SqlSmoObject
2119
{
22-
private SmoCollectionBase<TObject, TParent> collection;
20+
private SmoCollectionBase collection;
2321

2422
/// <summary>
2523
/// Constructor which accepts a <see cref="SmoCollectionBase"/> containing the objects
2624
/// to wrap
2725
/// </summary>
2826
/// <param name="collection"><see cref="SmoCollectionBase"/> or null if none were set</param>
29-
public SmoCollectionWrapper(SmoCollectionBase<TObject, TParent> collection)
27+
public SmoCollectionWrapper(SmoCollectionBase collection)
3028
{
3129
this.collection = collection;
3230
}
@@ -35,15 +33,15 @@ public SmoCollectionWrapper(SmoCollectionBase<TObject, TParent> collection)
3533
/// <see cref="IEnumerable{T}.GetEnumerator"/>
3634
/// </summary>
3735
/// <returns></returns>
38-
public IEnumerator<TObject> GetEnumerator()
36+
public IEnumerator<T> GetEnumerator()
3937
{
4038
if (collection == null)
4139
{
4240
yield break;
4341
}
4442
foreach(Object obj in collection)
4543
{
46-
yield return (TObject)obj;
44+
yield return (T)obj;
4745
}
4846
}
4947

src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoColumnCustomNode.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ internal static string GetTypeSpecifierLabel(DataType dataType, UserDefinedDataT
212212
typeName += "(max)";
213213
break;
214214
case SqlDataType.Vector:
215-
typeName += $"({dataType.VectorDimensions})";
215+
// Temporary workaround to convert the maxLength to dimensions for vector types
216+
// until SMO is updated to store the actual dimensions of the vector type.
217+
// https://msdata.visualstudio.com/SQLToolsAndLibraries/_workitems/edit/3906463
218+
// dimensions = (length - 8) / 4
219+
// https://learn.microsoft.com/sql/t-sql/data-types/vector-data-type
220+
typeName += $"({(dataType.MaximumLength - 8) / 4})";
216221
break;
217222
}
218223
}

0 commit comments

Comments
 (0)