diff --git a/source/.DS_Store b/source/.DS_Store new file mode 100644 index 0000000..81205d2 Binary files /dev/null and b/source/.DS_Store differ diff --git a/source/Server.Extensibility/HostServices/Model/PackageReference.cs b/source/Server.Extensibility/HostServices/Model/PackageReference.cs index 5f62825..048cb1d 100644 --- a/source/Server.Extensibility/HostServices/Model/PackageReference.cs +++ b/source/Server.Extensibility/HostServices/Model/PackageReference.cs @@ -28,10 +28,10 @@ public class PackageReference : IId, INamed /// /// The package-reference name. /// The package ID or a variable-expression - /// The feed ID or a variable-expression + /// The feed ID or a variable-expression /// The location the package should be acquired - public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrName, PackageAcquisitionLocation acquisitionLocation) - : this(name, packageId, feedIdOrName, acquisitionLocation.ToString()) + public PackageReference(string? name, string packageId, FeedId feedId, PackageAcquisitionLocation acquisitionLocation) + : this(name, packageId, feedId, acquisitionLocation.ToString()) { } @@ -40,14 +40,14 @@ public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrNam /// /// The package-reference name. /// The package ID or a variable-expression - /// The feed ID or a variable-expression + /// The feed ID or a variable-expression /// The location the package should be acquired. /// May be one or a variable-expression. - public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrName, string acquisitionLocation) + public PackageReference(string? name, string packageId, FeedId feedId, string acquisitionLocation) : this(null, name, packageId, - feedIdOrName, + feedId, acquisitionLocation) { } @@ -59,14 +59,14 @@ public PackageReference(string? name, string packageId, FeedIdOrName feedIdOrNam public PackageReference(string? id, string? name, string packageId, - FeedIdOrName feedIdOrName, + FeedId feedId, string acquisitionLocation) : this() { if (!string.IsNullOrEmpty(id)) Id = id; PackageId = packageId; - FeedIdOrName = feedIdOrName; + FeedId = feedId; AcquisitionLocation = acquisitionLocation; Name = name ?? string.Empty; } @@ -74,24 +74,24 @@ public PackageReference(string? id, /// /// Constructs a primary package (an un-named package reference) /// - public PackageReference(string packageId, FeedIdOrName feedIdOrName, PackageAcquisitionLocation acquisitionLocation) - : this(null, packageId, feedIdOrName, acquisitionLocation) + public PackageReference(string packageId, FeedId feedId, PackageAcquisitionLocation acquisitionLocation) + : this(null, packageId, feedId, acquisitionLocation) { } /// /// Constructs a primary package (an un-named package reference) /// - public PackageReference(string packageId, FeedIdOrName feedIdOrName, string acquisitionLocation) - : this(null, packageId, feedIdOrName, acquisitionLocation) + public PackageReference(string packageId, FeedId feedId, string acquisitionLocation) + : this(null, packageId, feedId, acquisitionLocation) { } /// /// Constructs a primary package (an un-named package reference) /// - public PackageReference(string packageId, FeedIdOrName feedIdOrName) - : this(packageId, feedIdOrName, PackageAcquisitionLocation.Server) + public PackageReference(string packageId, FeedId feedId) + : this(packageId, feedId, PackageAcquisitionLocation.Server) { } @@ -110,7 +110,7 @@ public PackageReference() { Id = Guid.NewGuid().ToString(); Properties = new Dictionary(); - FeedIdOrName = "feeds-builtin".ToFeedIdOrName(); + FeedId = "feeds-builtin".ToFeedId(); } public string Id { get; } @@ -132,9 +132,8 @@ public PackageReference() /// /// Feed ID, name or a variable-expression /// - [JsonProperty("FeedId")] // This is named FeedId for backward-compatibility as we don't yet want to change the underlying database JSON/schema. [OclName("feed")] - public FeedIdOrName FeedIdOrName { get; set; } + public FeedId FeedId { get; set; } /// /// The package-acquisition location. @@ -160,7 +159,7 @@ public PackageReference Clone() return new PackageReference(Id, Name, PackageId, - FeedIdOrName, + FeedId, AcquisitionLocation) { Properties = new Dictionary(Properties), diff --git a/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs b/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs index e1b0176..9e09e1e 100644 --- a/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs +++ b/source/Server.Extensibility/HostServices/Model/PackageReferenceCollection.cs @@ -96,15 +96,5 @@ public IResult TryGetById(string id) { return idMap.ContainsKey(id) ? (IResult)Result.Success(idMap[id]) : Result.Failed("Id not found"); } - - public IResult TryGetByIdOrName(string idOrName) - { - var result = TryGetById(idOrName); - if (result is Result) - return result; - - result = TryGetByName(idOrName); - return result; - } } } \ No newline at end of file