Thank you! But how would I go about using the mode...
# package-development
s
Thank you! But how would I go about using the model from v9 and v10? I don't know a way to have multiple versions of Umbraco in a single project
h
Never tried that I'm afraid 😦
s
Maybe it's not possible at all 🤷🏻‍♂️ Guess I will just work against dropping v9 in the version I am working on
h
You can import different packages based on the version of >net core, but it would be a pain to maintain I would guess since you would need to keep switching core version while developing the code
j
Also version of Umbraco does not necessarily correspond to a version of .NET in real world use
(and nor should it)
k
You can do it, but its hard / ugly. in your code you can check the version of Umbraco you are using and branch to Separate methods for each one. and use reflection to get the extra properties. its not nice - but it does work (had to do it in uSync a few times 😞 - key is code in a method is evaluated when the method is loaded, so if you have something that might cause an exception in one version of Umbraco it should be in a method behind an conditional check, so it never even gets to the point of evaluation. but in this case with extra properties Relection might well be enough (you can check to see if the model has the extra property and get and set the value using those methods.
How we do it in Umbraco 8 (in this example new properties have been added to the ContentType) https://github.com/KevinJump/uSync/blob/v8/8.10-main/uSync8.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs#L542-L573
also (and just because i can't help myself 😉 ) - According to Umbraco's own documentation - Umbraco 9 is no longer supported and receiving no updates (including security updates!) so you don't need to support it in your packages anymore.
s
Thank you! I guess I will be referring to Umbraco 9 is out of support - By far the easiet solution here 😄 The package is an old implementation of Azure AD / MS Graph that I have rewritten to make use of OAuth 2.0 instead of 1.0. We have some old sites still using it, but I guess this would be a good time to let the teams know that their solution needs multiple updates 🤷🏻‍♂️
j
There's nothing to stop you having two branches/versions of the package that target v9 & v10 respectively.