private void CreateProperties <T>(Class @class, Object @object, T domainObject) where T : DomainObject { foreach (PropertyInfo propertyInfo in typeof(T).GetProperties().Where(pi => pi.PropertyType == typeof(DomainProperty))) { DomainProperty domainProperty = propertyInfo.GetValue(domainObject) as DomainProperty; if (domainProperty != null) { Member member = this.memberRepositor.WithClassIdAndCode(@class.Id, propertyInfo.Name); if (member == null && @class.ClassId != null) { member = this.memberRepositor.WithClassIdAndCode((int)@class.ClassId, propertyInfo.Name); } if (member != null) { foreach (string cultureCode in domainProperty.Keys) { this.CreateProperty(@object.Id, member.Id, cultureCode, domainProperty[cultureCode]); } } } } }
public override void BuildProperty(Object @object, Member member, Property property, IDictionary <Culture, Localization> localizationsByCultures) { PropertyInfo propertyInfo = domainObject.GetType().GetProperty(member.Code); if (propertyInfo == null || propertyInfo.PropertyType != typeof(DomainProperty)) { return; } DomainProperty domainProperty = new DomainProperty(); foreach (Culture culture in localizationsByCultures.Keys) { domainProperty.Add(culture.Code, localizationsByCultures[culture]?.Value); } propertyInfo.SetValue(domainObject, domainProperty); }