VAF.Extensions.Community icon indicating copy to clipboard operation
VAF.Extensions.Community copied to clipboard

EXTENSION: ObjVerEx.GetExactVersionLookup() extension method

Open avonwyss opened this issue 3 years ago • 0 comments

There are methods for adding lookups with a specific version, e.g. AddLookup(propId, objVer, exactVersion) on both PropertyValues and ObjVerEx. However, when one needs to get a Lookup to an exact version, there is currently no helper available for doing so from an ObjVerEx.

The ToLookup(latestVersion) extension method will only set the lookup to the latest version (-1) when true is passed in, it will however not do the contrary when passing false and thus the returned Lookup remains latest-version if it was like this before.

Since changing this behavior would be a severely breaking change, it would make sense to keep this as-is and add an extension method GetExactVersionLookup which returns the exact version lookup, e.g. does this:

return new Lookup() {
    ObjectType = objVerEx.Type,
    Item = objVerEx.ID,
    Version = objVerEx.Version
}

avonwyss avatar Jan 06 '23 15:01 avonwyss