Advice - how can you make something compatibe with versions with diffrent interfaces ?
I suspect i know the answer to this, but advice would be welcome.
I want to keep uSync fully v8 backward compatible (that is one version works with v8.0 all the way through to v8.10)- but just noticed in v8.6 the interface for IRelationType changed
(see https://github.com/umbraco/Umbraco-CMS/pull/7303)
So now code qurying Relation Types with code compiled pre v8.6 will fail on 8.6+ because the method has changed - equally code compiled against 8.6+ will fail on older versions.
(not many people will be using usync for relations because we don't sync the core ones, and its only if you add your own and turn on relation syncing)
So any options - to keep cross version compatibility in one solution ?
As i see it.
Compile two versions and have two versions of a package (support headace)
Separate out the relationship code into two diffrent dlls' one compiled pre 8.6 one after, and then in the code load the relevant one based on the version of umbraco you are running (results in two new dlls added to the project)
Some fancy reflection thing ? that you could probably do but i don't know enough about reflection to do it ?
I am hoping someone has an idea about number 3 or a better number 4 ?
thanks for the sanity check - it does need some tidy up and yeah i got the nulls and empties mixed up.
I "think" i am going to go with if there is no value then don't do the set (i was thinking Guid.Empty on legacy sites, but that might actually cause other problems,.
Advice - how can you make something compatibe with versions with diffrent interfaces ?
I suspect i know the answer to this, but advice would be welcome.
I want to keep uSync fully v8 backward compatible (that is one version works with v8.0 all the way through to v8.10)- but just noticed in v8.6 the interface for IRelationType changed (see https://github.com/umbraco/Umbraco-CMS/pull/7303)
principally the GUID values when nullable :
So now code qurying Relation Types with code compiled pre v8.6 will fail on 8.6+ because the method has changed - equally code compiled against 8.6+ will fail on older versions. (not many people will be using usync for relations because we don't sync the core ones, and its only if you add your own and turn on relation syncing)
So any options - to keep cross version compatibility in one solution ?
As i see it.
I am hoping someone has an idea about number 3 or a better number 4 ?
I feel that #1 would be a hassle and #2 just feels icky.
I'm not one to shy away from reflection, so I would give #3 a go.
I could whip something up.
Hi,
I think i have the skeleton of No3 now.
some helper methods to get/set the guids.
and a reflection method to find the new constructor should it exist (still testing all of this)
but equally i am just pasting from docs here, so if there is a better/nicer/more robust way....
Hi,
I see your almost there :-).
Without actually trying this out, I would say the below code in GetGuidValue() adds nothing (but also doesn't break anything).
In SetGuidValue() however, I believe it doesn't actually assign any value when it's a Guid and not Guid? ...
I think you mean to assign value.Value, no?
The constructor-approach looks solid.
thanks for the sanity check - it does need some tidy up and yeah i got the nulls and empties mixed up.
I "think" i am going to go with if there is no value then don't do the set (i was thinking Guid.Empty on legacy sites, but that might actually cause other problems,.
is working on a reply...