Accessing the Value IEnumerable produces a RuntimeBinderException.
using Kontent.Ai.Management.Models.LanguageVariants.Elements;
using Kontent.Ai.Management.Models.Shared;
using Kontent.Ai.Management.Models.Types.Elements;
var taxonomy = new TaxonomyElement
{
Element = Reference.ByCodename("my_taxonomy"),
Value = [Reference.ByCodename("my_taxonomy_item_1")]
};
var taxonomy2 = (TaxonomyElement) TaxonomyElement.FromDynamic(taxonomy.ToDynamic(), ElementMetadataType.Taxonomy);
var value1 = taxonomy2.Value.First();
Exception message: 'Kontent.Ai.Management.Models.Shared.Reference' does not contain a definition for 'id'
Stack trace
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Kontent.Ai.Management.Models.LanguageVariants.Elements.BaseElement.<>c.<FromDynamic>b__6_5(Object identifier)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at Program.<Main>$(String[] args) in D:\repos\demo\KontentAiMigrationAssistant\KontentAiMigrationAssistant\Program.cs:line 42
I also tried with Reference.ById and Reference.ByExternalId for the Value item and all produced the same exception.
hello and thanks for the submission, as well as the draft PR. I'll review the issue and the proposed changes but feel free to add further improvements before marking the PR for review.
Description
Accessing the Value IEnumerable produces a RuntimeBinderException.
Exception message:
'Kontent.Ai.Management.Models.Shared.Reference' does not contain a definition for 'id'
Stack trace
I also tried with
Reference.ById
andReference.ByExternalId
for the Value item and all produced the same exception.Test environment