-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5285 Remove TrackedResource<TIdentifier, TModel> class. (#21376)
* Delete TrackedResource.cs * Removed class from Core added to individual Proto Libraries * Removing imported class in Proto.Client * Add missing new lines
- Loading branch information
1 parent
09b2b13
commit d936847
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
sdk/resourcemanager/Proto.Client/compute/TrackedResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
namespace Azure.ResourceManager.Core.Adapters | ||
{ | ||
/// <summary> | ||
/// A class representing a generic tracked resource in Azure. | ||
/// </summary> | ||
/// <typeparam name="TIdentifier"> The type of the underlying resource id </typeparam> | ||
/// <typeparam name="TModel"> The type of the underlying model this class wraps </typeparam> | ||
public abstract class TrackedResource<TIdentifier, TModel> : TrackedResource<TIdentifier> | ||
where TIdentifier : TenantResourceIdentifier | ||
where TModel : class | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TrackedResource{TModel, TIdentifier}"/> class. | ||
/// </summary> | ||
/// <param name="id"> The identifier of the resource that is the target of operations. </param> | ||
/// <param name="location"> The location of the resource. </param> | ||
/// <param name="data"> The model to copy from. </param> | ||
protected TrackedResource(TIdentifier id, LocationData location, TModel data) | ||
: base(id, id?.Name, id?.ResourceType, location, null) | ||
{ | ||
Model = data; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the Model this resource is based off. | ||
/// </summary> | ||
public virtual TModel Model { get; set; } | ||
|
||
/// <summary> | ||
/// Converts from a <see cref="TrackedResource{TModel}"/> into the TModel. | ||
/// </summary> | ||
/// <param name="other"> The tracked resource convert from. </param> | ||
public static implicit operator TModel(TrackedResource<TIdentifier, TModel> other) | ||
{ | ||
return other.Model; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
sdk/resourcemanager/Proto.Client/network/TrackedResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
namespace Azure.ResourceManager.Core.Adapters | ||
{ | ||
/// <summary> | ||
/// A class representing a generic tracked resource in Azure. | ||
/// </summary> | ||
/// <typeparam name="TIdentifier"> The type of the underlying resource id </typeparam> | ||
/// <typeparam name="TModel"> The type of the underlying model this class wraps </typeparam> | ||
public abstract class TrackedResource<TIdentifier, TModel> : TrackedResource<TIdentifier> | ||
where TIdentifier : TenantResourceIdentifier | ||
where TModel : class | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TrackedResource{TModel, TIdentifier}"/> class. | ||
/// </summary> | ||
/// <param name="id"> The identifier of the resource that is the target of operations. </param> | ||
/// <param name="location"> The location of the resource. </param> | ||
/// <param name="data"> The model to copy from. </param> | ||
protected TrackedResource(TIdentifier id, LocationData location, TModel data) | ||
: base(id, id?.Name, id?.ResourceType, location, null) | ||
{ | ||
Model = data; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the Model this resource is based off. | ||
/// </summary> | ||
public virtual TModel Model { get; set; } | ||
|
||
/// <summary> | ||
/// Converts from a <see cref="TrackedResource{TModel}"/> into the TModel. | ||
/// </summary> | ||
/// <param name="other"> The tracked resource convert from. </param> | ||
public static implicit operator TModel(TrackedResource<TIdentifier, TModel> other) | ||
{ | ||
return other.Model; | ||
} | ||
} | ||
} |