Skip to content

Commit 6c3b8e8

Browse files
authored
Bumping SMO to v180 (#2531)
* Updating SMO * Porting updates to T4 templates * Fixing vector test now that workaround has a real solution
1 parent eb45cd1 commit 6c3b8e8

File tree

10 files changed

+197
-153
lines changed

10 files changed

+197
-153
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="172.64.0" />
69+
<PackageReference Update="Microsoft.SqlServer.SqlManagementObjects" Version="180.9.0-preview" />
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 schedules = jobs[parameters.JobName].JobSchedules;
226+
JobScheduleCollection<Job> 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 schedules = jobs[jobName].JobSchedules;
1483+
JobScheduleCollection<Job> 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 schedules = job.JobSchedules;
152+
JobScheduleCollection<Job> schedules = job.JobSchedules;
153153

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

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ 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="T"></typeparam>
17-
public class SmoCollectionWrapper<T> : IEnumerable<T>
18-
where T : SqlSmoObject
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
1921
{
20-
private SmoCollectionBase collection;
22+
private SmoCollectionBase<TObject, TParent> collection;
2123

2224
/// <summary>
2325
/// Constructor which accepts a <see cref="SmoCollectionBase"/> containing the objects
2426
/// to wrap
2527
/// </summary>
2628
/// <param name="collection"><see cref="SmoCollectionBase"/> or null if none were set</param>
27-
public SmoCollectionWrapper(SmoCollectionBase collection)
29+
public SmoCollectionWrapper(SmoCollectionBase<TObject, TParent> collection)
2830
{
2931
this.collection = collection;
3032
}
@@ -33,15 +35,15 @@ public SmoCollectionWrapper(SmoCollectionBase collection)
3335
/// <see cref="IEnumerable{T}.GetEnumerator"/>
3436
/// </summary>
3537
/// <returns></returns>
36-
public IEnumerator<T> GetEnumerator()
38+
public IEnumerator<TObject> GetEnumerator()
3739
{
3840
if (collection == null)
3941
{
4042
yield break;
4143
}
4244
foreach(Object obj in collection)
4345
{
44-
yield return (T)obj;
46+
yield return (TObject)obj;
4547
}
4648
}
4749

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,7 @@ internal static string GetTypeSpecifierLabel(DataType dataType, UserDefinedDataT
212212
typeName += "(max)";
213213
break;
214214
case SqlDataType.Vector:
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})";
215+
typeName += $"({dataType.VectorDimensions})";
221216
break;
222217
}
223218
}

0 commit comments

Comments
 (0)