Open sandboxFocus

Class ObjectDependency

Wraps an object into an ICacheDependency. The GetCacheKey(ICachingService) method relies on the KeyBuilder to create the cache key of the wrapped object.

Inheritance
ObjectDependency
Namespace: Metalama.Patterns.Caching.Dependencies
Assembly: Metalama.Patterns.Caching.dll
Syntax
public sealed record ObjectDependency : ICacheDependency, IEquatable<ObjectDependency>
Remarks

Use this class when you have objects that already implement cache key generation (through the CacheKeyAttribute aspect or a custom formatter) and want to use them as dependencies.

Alternatively, you can use the AddObjectDependency(ICachingService, object) and InvalidateObject(ICachingService, object) extension methods to avoid creating wrapper objects.

Constructors

Name Description
ObjectDependency(object)

Wraps an object into an ICacheDependency. The GetCacheKey(ICachingService) method relies on the KeyBuilder to create the cache key of the wrapped object.

Properties

Name Description
Object

Methods

Name Description
Deconstruct(out object)
Equals(ObjectDependency?)
Equals(object?)
GetCacheKey(ICachingService)

Gets a string that uniquely represents the current object.

GetHashCode()
ToString()

Operators

Name Description
operator ==(ObjectDependency?, ObjectDependency?)
operator !=(ObjectDependency?, ObjectDependency?)

Extension Methods

See Also