public GetIdFromObjectOp <TId, TObject> DeepCloneWithObjectToDetermineIdFrom(TObject objectToDetermineIdFrom) { var result = new GetIdFromObjectOp <TId, TObject>( objectToDetermineIdFrom); return(result); }
/// <inheritdoc /> public async Task <TId> ExecuteAsync( GetIdFromObjectOp <TId, TObject> operation) { var syncResult = this.Execute(operation); var result = await Task.FromResult(syncResult); return(result); }
/// <inheritdoc /> public TId Execute( GetIdFromObjectOp <TId, TObject> operation) { if (operation.ObjectToDetermineIdFrom is IIdentifiableBy <TId> identifiableObject) { return(identifiableObject.Id); } throw new ArgumentException(FormattableString.Invariant($"Cannot extract an Id from type '{typeof(TObject).ToStringReadable()}' because it does not implement '{typeof(IIdentifiableBy<TId>).ToStringReadable()}'.")); }
/// <inheritdoc /> public bool Equals(GetIdFromObjectOp <TId, TObject> other) { if (ReferenceEquals(this, other)) { return(true); } if (ReferenceEquals(other, null)) { return(false); } var result = this.ObjectToDetermineIdFrom.IsEqualTo(other.ObjectToDetermineIdFrom); return(result); }