|
22 | 22 | using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
|
23 | 23 | using Microsoft.Azure.Management.Synapse.Models;
|
24 | 24 | using Microsoft.WindowsAzure.Commands.Utilities.Common;
|
| 25 | +using System; |
25 | 26 | using System.Collections;
|
26 | 27 | using System.Collections.Generic;
|
27 | 28 | using System.IO;
|
@@ -242,9 +243,9 @@ public override void ExecuteCmdlet()
|
242 | 243 | Name = psPackage?.Name,
|
243 | 244 | Type = psPackage?.PackageType,
|
244 | 245 | Path = psPackage?.Path,
|
245 |
| - ContainerName = psPackage?.ContainerName |
246 |
| - // TODO: set uploadedTimeStamp property after upgrading SDK otherwise we will see a incorrect property value from Azure portal. |
247 |
| - })).ToList(); |
| 246 | + ContainerName = psPackage?.ContainerName, |
| 247 | + UploadedTimestamp = DateTime.Parse(psPackage?.UploadedTimestamp).ToUniversalTime() |
| 248 | + }), new LibraryComparer()).ToList(); |
248 | 249 | }
|
249 | 250 | else if (this.PackageAction == SynapseConstants.PackageActionType.Remove)
|
250 | 251 | {
|
@@ -296,5 +297,34 @@ private SparkConfigProperties CreateSparkConfigProperties()
|
296 | 297 | Content = this.ReadFileAsText(powerShellDestinationPath)
|
297 | 298 | };
|
298 | 299 | }
|
| 300 | + |
| 301 | + private class LibraryComparer : IEqualityComparer<LibraryInfo> |
| 302 | + { |
| 303 | + public bool Equals(LibraryInfo x, LibraryInfo y) |
| 304 | + { |
| 305 | + //Check whether the compared objects reference the same data. |
| 306 | + if (Object.ReferenceEquals(x, y)) return true; |
| 307 | + |
| 308 | + //Check whether any of the compared objects is null. |
| 309 | + if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null)) |
| 310 | + return false; |
| 311 | + |
| 312 | + return x.Name == y.Name |
| 313 | + && x.Path == y.Path |
| 314 | + && x.ContainerName == y.ContainerName |
| 315 | + && x.UploadedTimestamp == y.UploadedTimestamp |
| 316 | + && x.Type == y.Type; |
| 317 | + |
| 318 | + } |
| 319 | + public int GetHashCode(LibraryInfo obj) |
| 320 | + { |
| 321 | + //Check whether the object is null |
| 322 | + if (Object.ReferenceEquals(obj, null)) return 0; |
| 323 | + |
| 324 | + //Get hash code for the object if it is not null. |
| 325 | + int hCode = obj.Name.GetHashCode() ^ obj.Path.GetHashCode() ^ obj.ContainerName.GetHashCode() ^ obj.UploadedTimestamp.GetHashCode() ^ obj.Type.GetHashCode(); |
| 326 | + return hCode; |
| 327 | + } |
| 328 | + } |
299 | 329 | }
|
300 | 330 | }
|
0 commit comments