private void UpdateId(object source, Abstract1CEntity target, ConfigurationName name) { var property = target.GetType().GetProperty(EntityHelpers.idPropertyName); if (property == null) { const string messageFormat = "type [{0}] has no id"; throw new InvalidOperationException(string.Format(messageFormat, name)); } var idValue = ComHelpers.Invoke(source, EntityHelpers.idPropertyName); idValue = comObjectMapper.MapFrom1C(idValue, typeof(Guid)); SetValueWithoutTracking(target, property, idValue); }
bool IValueSource.TryLoadValue(string name, Type type, out object result) { var isUniqueIdentifier = name == EntityHelpers.idPropertyName && type == typeof(Guid?); var propertyValue = isUniqueIdentifier ? ComHelpers.Invoke(comObject, name) : ComHelpers.GetProperty(comObject, name); result = comObjectMapper.MapFrom1C(propertyValue, type); return(true); }