diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj index ce45627..5c1bf06 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj @@ -5,7 +5,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.20 + 0.0.0.21 client generated code. EasyMicroservices@gmail.com microservice,Content,Contents,client diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs index f06d21a..081122b 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs @@ -118,34 +118,44 @@ async Task ResolveContentLanguage(object contract, string language, HashSet() != null) + foreach (var item in (IEnumerable)contract) { - var contentResult = await _contentClient.GetByLanguageAsync(new GetByLanguageRequestContract() - { - Key = property.Name, - UniqueIdentity = GetUniqueIdentity(contract), - Language = language - }); - if (contentResult.IsSuccess) - property.SetValue(contract, contentResult.Result.Data); + await ResolveContentLanguage(item, language, mappedItems); } - else if (IsClass(property.PropertyType) && typeof(IEnumerable).IsAssignableFrom(property.PropertyType)) + } + else + { + foreach (var property in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)) { - var items = property.GetValue(contract); - if (items == null) - continue; - foreach (var item in (IEnumerable)items) + if (property.GetCustomAttribute() != null) { - await ResolveContentLanguage(item, language, mappedItems); + var contentResult = await _contentClient.GetByLanguageAsync(new GetByLanguageRequestContract() + { + Key = property.Name, + UniqueIdentity = GetUniqueIdentity(contract), + Language = language + }); + if (contentResult.IsSuccess) + property.SetValue(contract, contentResult.Result.Data); + } + else if (IsClass(property.PropertyType) && typeof(IEnumerable).IsAssignableFrom(property.PropertyType)) + { + var items = property.GetValue(contract); + if (items == null) + continue; + foreach (var item in (IEnumerable)items) + { + await ResolveContentLanguage(item, language, mappedItems); + } + } + else if (IsClass(property.PropertyType)) + { + var value = property.GetValue(contract); + if (value != null) + await ResolveContentLanguage(value, language, mappedItems); } - } - else if (IsClass(property.PropertyType)) - { - var value = property.GetValue(contract); - if (value != null) - await ResolveContentLanguage(value, language, mappedItems); } } }