private void Write(object comObject, ConfigurationName name, bool?posting) { object argument; string argumentString; if (name.Scope == ConfigurationScope.егистрыСведений) { argument = true; argumentString = argument.ToString(); } else { var writeModeName = posting.HasValue ? (posting.Value ? "Проведение" : "ОтменаПроведения") : "Запись"; var writeMode = globalContext.ежимЗаписиДокумента(); argument = ComHelpers.GetProperty(writeMode, writeModeName); argumentString = "РежимЗаписиДокумента." + writeModeName; } try { ComHelpers.Invoke(comObject, "Write", argument); } catch (TargetInvocationException e) { const string messageFormat = "error writing document [{0}] with argument [{1}]"; throw new InvalidOperationException(string.Format(messageFormat, name.Fullname, argumentString), e.InnerException); } }
private string[] GetPropertyTypes(object a) { var type = ComHelpers.GetProperty(a, "Тип"); var typesObject = ComHelpers.Invoke(type, "Типы"); var typesCount = Call.Количество(typesObject); if (typesCount == 0) { throw new InvalidOperationException("assertion failure"); } var types = new string[typesCount]; for (var i = 0; i < typesCount; i++) { var typeObject = Call.Получить(typesObject, i); var stringPresentation = globalContext.String(typeObject); if (MetadataHelpers.simpleTypesMap.ContainsKey(stringPresentation)) { return(null); } var propertyComObject = Call.НайтиПоТипу(globalContext.Metadata, typeObject); if (propertyComObject == null) { return(null); } types[i] = Call.ПолноеИмя(propertyComObject); } return(types); }
public void Recreate() { object comTable = null; LogHelpers.LogWithTiming("loading COM schema info", () => comTable = ComHelpers.Invoke(globalContext.ComObject(), "ПолучитьСтруктуруХраненияБазыДанных", Missing.Value, true)); TableMapping[] tableMappings = null; LogHelpers.LogWithTiming("extracting table mappings from COM schema info", () => tableMappings = ExtractTableMappingsFromCom(comTable)); LogHelpers.LogWithTiming("recreating db schema", () => database.RecreateSchema("simple1c")); LogHelpers.LogWithTiming("writing table mappings to db", () => store.WriteTableMappings(tableMappings)); EnumMapping[] enumMappings = null; LogHelpers.LogWithTiming("extracting enum mappings from COM ", () => enumMappings = ExtractEnumMappingsFromCom()); LogHelpers.LogWithTiming("writing enum mappings to db", () => store.WriteEnumMappings(enumMappings)); LogHelpers.LogWithTiming("creating helper functions", () => CreateHelperFunctions(tableMappings)); }
private int?GetMaxLength(object attribute) { var type = ComHelpers.GetProperty(attribute, "Тип"); var typesObject = ComHelpers.Invoke(type, "Типы"); var typesCount = Call.Количество(typesObject); if (typesCount != 1) { return(null); } var typeObject = Call.Получить(typesObject, 0); var stringPresentation = globalContext.String(typeObject); if (stringPresentation != "Строка") { return(null); } var квалификаторыСтроки = ComHelpers.GetProperty(type, "КвалификаторыСтроки"); var result = Call.IntProp(квалификаторыСтроки, "Длина"); if (result == 0) { return(null); } return(result); }
private IEnumerable Execute(BuiltQuery builtQuery) { if (EntityHelpers.IsConstant(builtQuery.EntityType)) { var constantWrapType = builtQuery.EntityType.BaseType; if (constantWrapType == null) { throw new InvalidOperationException("assertion failure"); } var constantWrap = (Constant)FormatterServices.GetUninitializedObject(builtQuery.EntityType); var constants = ComHelpers.GetProperty(globalContext.ComObject(), "Константы"); var constant = ComHelpers.GetProperty(constants, builtQuery.EntityType.Name); var value = ComHelpers.Invoke(constant, "Получить"); constantWrap.ЗначениеНетипизированное = comObjectMapper.MapFrom1C(value, constantWrapType.GetGenericArguments()[0]); yield return(constantWrap); yield break; } var queryText = builtQuery.QueryText; var parameters = builtQuery.Parameters; parametersConverter.ConvertParametersTo1C(parameters); var hasReference = ConfigurationName.Get(builtQuery.EntityType).HasReference; var queryResult = globalContext.Execute(queryText, parameters); if (hasReference || builtQuery.Projection != null) { var projection = builtQuery.Projection != null ? ProjectionMapperFactory.GetMapper(builtQuery.Projection, comObjectMapper) : null; var selection = queryResult.Select(); while (selection.Next()) { if (projection != null) { yield return(projection(selection.ComObject)); } else if (builtQuery.IsCount) { yield return(comObjectMapper.MapFrom1C(selection["src_Count"], typeof(int))); } else { yield return(comObjectMapper.MapFrom1C(selection["Ссылка"], builtQuery.EntityType)); } } } else { var valueTable = queryResult.Unload(); foreach (var r in valueTable) { yield return(comObjectMapper.MapFrom1C(r.ComObject(), builtQuery.EntityType)); } } }
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); }
public ConfigurationItem FindMetaByName(ConfigurationName fullname) { var itemMetadata = ComHelpers.Invoke(Metadata, "НайтиПоПолномуИмени", fullname.Fullname); if (itemMetadata == null) { const string messageFormat = "can't find [{0}]"; throw new InvalidOperationException(string.Format(messageFormat, fullname.Fullname)); } return(new ConfigurationItem(fullname, itemMetadata)); }
public object GetValue(object queryResultRow) { var result = ComHelpers.GetProperty(queryResultRow, Alias); if (isUniqueIdentifier) { result = result == null || result == DBNull.Value ? null : ComHelpers.Invoke(result, EntityHelpers.idPropertyName); } return(result); }
private void SaveConstant(Constant constantEntity) { var configurationName = new ConfigurationName(ConfigurationScope.Константы, constantEntity.GetType().Name); var metadata = metadataAccessor.GetMetadata(configurationName); var valueToSave = constantEntity.ЗначениеНетипизированное; metadata.Validate(null, valueToSave); var constant = globalContext.GetManager(configurationName); var value = comObjectMapper.MapTo1C(valueToSave); ComHelpers.Invoke(constant, "Установить", value); }
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); }
private EnumMapItem[] GetMappings(Type enumType) { var enumeration = ComHelpers.GetProperty(enumerations, enumType.Name); return(Enum.GetValues(enumType) .Cast <object>() .Select(v => new EnumMapItem { value = v, index = Convert.ToInt32(ComHelpers.Invoke(enumeration, "IndexOf", ComHelpers.GetProperty(enumeration, v.ToString()))) }) .ToArray()); }
private object MapEnumFrom1C(Type enumType, object value1C) { var enumeration = ComHelpers.GetProperty(enumerations, enumType.Name); var valueIndex = Convert.ToInt32(ComHelpers.Invoke(enumeration, "IndexOf", value1C)); var result = mappingSource.EnumMappingsCache.GetOrAdd(enumType, GetMappings) .SingleOrDefault(x => x.index == valueIndex); if (result == null) { const string messageFormat = "can't map value [{0}] to enum [{1}]"; throw new InvalidOperationException(string.Format(messageFormat, globalContext.String(value1C), enumType.Name)); } return(result.value); }
public void RecreateRoutines() { object comTable = null; LogHelpers.LogWithTiming("loading COM schema info", () => comTable = ComHelpers.Invoke(globalContext.ComObject(), "ПолучитьСтруктуруХраненияБазыДанных", Missing.Value, true)); TableMapping[] tableMappings = null; LogHelpers.LogWithTiming("extracting table mappings from COM schema info", () => tableMappings = ExtractTableMappingsFromCom(comTable)); LogHelpers.LogWithTiming("removing helper functions", RemoveHelperFunctions); LogHelpers.LogWithTiming("creating helper functions", () => CreateHelperFunctions(tableMappings)); }
private object ConvertParameterValue(object value) { var convertEnum = value as ConvertEnumCmd; if (convertEnum != null) { return(comObjectMapper.MapEnumTo1C(convertEnum.valueIndex, convertEnum.enumType)); } var convertUniqueIdentifier = value as ConvertUniqueIdentifierCmd; if (convertUniqueIdentifier != null) { var name = ConfigurationName.Get(convertUniqueIdentifier.entityType); var itemManager = globalContext.GetManager(name); var guidComObject = comObjectMapper.MapGuidTo1C(convertUniqueIdentifier.id); return(ComHelpers.Invoke(itemManager, "ѕолучить—сылку", guidComObject)); } throw new InvalidOperationException("assertion failure"); }
private object ConvertParameterValue(object value) { switch (value) { case ConvertEnumCmd convertEnum: return(comObjectMapper.MapEnumTo1C(convertEnum.valueIndex, convertEnum.enumType)); case ConvertUniqueIdentifierCmd convertUniqueIdentifier: { var name = ConfigurationName.Get(convertUniqueIdentifier.entityType); var itemManager = globalContext.GetManager(name); var guidComObject = comObjectMapper.MapGuidTo1C(convertUniqueIdentifier.id); return(ComHelpers.Invoke(itemManager, "ПолучитьСсылку", guidComObject)); } default: throw new InvalidOperationException("assertion failure"); } }
private EnumMapping[] ExtractEnumMappingsFromCom() { var enumsManager = ComHelpers.GetProperty(globalContext.ComObject(), "Перечисления"); var enumsMeta = ComHelpers.GetProperty(globalContext.Metadata, "Перечисления"); var enumsCount = Call.Количество(enumsMeta); var result = new List <EnumMapping>(); for (var i = 0; i < enumsCount; i++) { var enumMeta = Call.Получить(enumsMeta, i); var enumName = Call.Имя(enumMeta); var enumManager = ComHelpers.GetProperty(enumsManager, enumName); var enumValuesMeta = ComHelpers.GetProperty(enumMeta, "ЗначенияПеречисления"); var valuesCount = Call.Количество(enumValuesMeta); for (var j = 0; j < valuesCount; j++) { var enumValueMeta = Call.Получить(enumValuesMeta, j); var enumValueName = Call.Имя(enumValueMeta); object enumValue = null; try { enumValue = ComHelpers.GetProperty(enumManager, enumValueName); } catch { //сраный 1С куда-то проебывает (DISP_E_MEMBERNOTFOUND) //УсловияПримененияТребованийЗаконодательства.ЕстьТранспортныеСредства //и только это значения этого енума, остальные на месте } if (enumValue != null) { var order = Convert.ToInt32(ComHelpers.Invoke(enumManager, "Индекс", enumValue)); result.Add(new EnumMapping { enumName = enumName.ToLower(), enumValueName = enumValueName.ToLower(), orderIndex = order }); } } } return(result.ToArray()); }
private object GetComObjectForEditing(ConfigurationName name, Abstract1CEntity entity) { var controller = entity.Controller; var valueSource = controller.ValueSource; if (!controller.IsNew && name.HasReference) { return(ComHelpers.Invoke(valueSource.GetBackingStorage(), "ПолучитьОбъект")); } switch (name.Scope) { case ConfigurationScope.Справочники: object isGroup; var needCreateFolder = controller.Changed != null && controller.Changed.TryGetValue("ЭтоГруппа", out isGroup) && (bool)isGroup; return(needCreateFolder ? ComHelpers.Invoke(globalContext.GetManager(name), "CreateFolder") : ComHelpers.Invoke(globalContext.GetManager(name), "CreateItem")); case ConfigurationScope.Документы: return(ComHelpers.Invoke(globalContext.GetManager(name), "CreateDocument")); case ConfigurationScope.егистрыСведений: return(valueSource != null && valueSource.Writable ? valueSource.GetBackingStorage() : ComHelpers.Invoke(globalContext.GetManager(name), "СоздатьМенеджерЗаписи")); case ConfigurationScope.ПланыСчетов: case ConfigurationScope.ПланыВидовХарактеристик: const string message = "creation of [{0}] is not implemented"; throw new InvalidOperationException(string.Format(message, name.Scope)); case ConfigurationScope.Перечисления: case ConfigurationScope.Константы: throw new InvalidOperationException("assertion failure"); default: const string messageFormat = "invalid scope for [{0}]"; throw new ArgumentOutOfRangeException(string.Format(messageFormat, name)); } }
public static List <TypeInfo> GetTypesOrNull(this GlobalContext globalContext, object item) { var typeDescriptor = ComHelpers.GetProperty(item, "Тип"); var types = ComHelpers.Invoke(typeDescriptor, "Типы"); var typesCount = Call.Количество(types); if (typesCount == 0) { throw new InvalidOperationException("assertion failure"); } var result = new List <TypeInfo>(); for (var i = 0; i < typesCount; i++) { var typeObject = Call.Получить(types, i); var typeInfo = GetTypeInfoOrNull(globalContext, typeDescriptor, typeObject); if (typeInfo.HasValue) { result.Add(typeInfo.Value); } } return(result.Count == 0 ? null : result); }
public void CanAddCounterpartyWithNullableEnum() { var counterparty = new Контрагенты { ИНН = "1234567890", Наименование = "test-counterparty", ЮридическоеФизическоеЛицо = null }; dataContext.Save(counterparty); Assert.That(string.IsNullOrEmpty(counterparty.Код), Is.False); var valueTable = globalContext.Execute("ВЫБРАТЬ * ИЗ Справочник.Контрагенты ГДЕ Код=&Code", new Dictionary <string, object> { { "Code", counterparty.Код } }).Unload(); Assert.That(valueTable.Count, Is.EqualTo(1)); Assert.That(valueTable[0].GetString("ИНН"), Is.EqualTo("1234567890")); Assert.That(valueTable[0].GetString("Наименование"), Is.EqualTo("test-counterparty")); Assert.That(ComHelpers.Invoke(valueTable[0]["ЮридическоеФизическоеЛицо"], "IsEmpty"), Is.True); }
public static int Количество(object comObject) { return(Convert.ToInt32(ComHelpers.Invoke(comObject, "Количество"))); }
private TypeDescriptor?GetTypeDescriptor(object metadataItem, string fullname, GenerationContext context) { var type = ComHelpers.GetProperty(metadataItem, "Тип"); var typesObject = ComHelpers.Invoke(type, "Типы"); var typesCount = Call.Количество(typesObject); if (typesCount == 0) { const string messageFormat = "no types for [{0}]"; throw new InvalidOperationException(string.Format(messageFormat, fullname)); } object typeObject; string stringPresentation; if (typesCount > 1) { for (var i = 0; i < typesCount; i++) { typeObject = Call.Получить(typesObject, i); stringPresentation = globalContext.String(typeObject); if (stringPresentation != "Число" && !MetadataHelpers.simpleTypesMap.ContainsKey(stringPresentation)) { var configurationItem = FindByType(typeObject); if (configurationItem != null) { context.EnqueueIfNeeded(configurationItem); } } } return(new TypeDescriptor { dotnetType = "object" }); } typeObject = Call.Получить(typesObject, 0); stringPresentation = globalContext.String(typeObject); string typeName; if (MetadataHelpers.simpleTypesMap.TryGetValue(stringPresentation, out typeName)) { if (typeName == null) { return(null); } int?maxLength; if (typeName == "string") { var квалификаторыСтроки = ComHelpers.GetProperty(type, "КвалификаторыСтроки"); maxLength = Call.IntProp(квалификаторыСтроки, "Длина"); if (maxLength == 0) { maxLength = null; } } else { maxLength = null; } return(new TypeDescriptor { dotnetType = typeName, maxLength = maxLength }); } if (stringPresentation == "Число") { var квалификаторыЧисла = ComHelpers.GetProperty(type, "КвалификаторыЧисла"); var floatLength = Convert.ToInt32(ComHelpers.GetProperty(квалификаторыЧисла, "РазрядностьДробнойЧасти")); var digits = Convert.ToInt32(ComHelpers.GetProperty(квалификаторыЧисла, "Разрядность")); return(new TypeDescriptor { dotnetType = floatLength == 0 ? (digits < 10 ? "int" : "long") : "decimal" }); } var propertyItem = FindByType(typeObject); if (propertyItem == null) { return(null); } context.EnqueueIfNeeded(propertyItem); typeName = FormatClassName(propertyItem.Name); if (propertyItem.Name.Scope == ConfigurationScope.Перечисления) { typeName = typeName + "?"; } return(new TypeDescriptor { dotnetType = typeName }); }
public object MapGuidTo1C(Guid value) { return(ComHelpers.Invoke(globalContext.ComObject(), "NewObject", "УникальныйИдентификатор", value.ToString())); }
public static bool IsEmpty(object comObject) { return((bool)ComHelpers.Invoke(comObject, "IsEmpty")); }
public object MapFrom1C(object source, Type type) { if (source == null || source == DBNull.Value) { return(null); } if (type == typeof(object)) { if (source is MarshalByRefObject) { var typeName = GetFullName(source); type = mappingSource.TypeRegistry.GetType(typeName); } else { type = source.GetType(); } } type = Nullable.GetUnderlyingType(type) ?? type; if (type == typeof(DateTime)) { var dateTime = (DateTime)source; return(dateTime == nullDateTime ? null : source); } if (type == typeof(Guid)) { var guid = Guid.Parse(globalContext.String(source)); return(guid == Guid.Empty ? (object)null : guid); } if (type.IsEnum) { return(Call.IsEmpty(source) ? null : MapEnumFrom1C(type, source)); } if (type == typeof(Type)) { return(ConvertType(source)); } if (type == typeof(Type[])) { var typesObject = ComHelpers.Invoke(source, "Типы"); var typesCount = Call.Количество(typesObject); var result = new Type[typesCount]; for (var i = 0; i < result.Length; i++) { var typeObject = Call.Получить(typesObject, i); result[i] = ConvertType(typeObject); } return(result); } if (typeof(Abstract1CEntity).IsAssignableFrom(type)) { var configurationName = ConfigurationName.GetOrNull(type); var isEmpty = configurationName.HasValue && configurationName.Value.HasReference && Call.IsEmpty(source); if (isEmpty) { return(null); } var result = (Abstract1CEntity)FormatterServices.GetUninitializedObject(type); result.Controller = new EntityController(new ComValueSource(source, this, false)); return(result); } if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List <>)) { var itemType = type.GetGenericArguments()[0]; if (!typeof(Abstract1CEntity).IsAssignableFrom(itemType)) { throw new InvalidOperationException("assertion failure"); } var itemsCount = Call.Количество(source); var list = ListFactory.Create(itemType, null, itemsCount); for (var i = 0; i < itemsCount; ++i) { list.Add(MapFrom1C(Call.Получить(source, i), itemType)); } return(list); } return(source is IConvertible?Convert.ChangeType(source, type) : source); }
public static string ПолноеИмя(object comObject) { return(Convert.ToString(ComHelpers.Invoke(comObject, "ПолноеИмя"))); }
private TableMapping CreateDefaultTableMapping(ValueTableRow tableRow, Dictionary <string, TableMapping> tableMappingByQueryName) { var queryTableName = tableRow.GetString("ИмяТаблицы"); if (string.IsNullOrEmpty(queryTableName)) { return(null); } var dbTableName = tableRow.GetString("ИмяТаблицыХранения"); if (string.IsNullOrEmpty(dbTableName)) { return(null); } var purpose = tableRow.GetString("Назначение"); ConfigurationItemDescriptor descriptor; object comObject; TableType tableType; if (purpose == "Основная" || purpose == "Константа") { var configurationName = ConfigurationName.ParseOrNull(queryTableName); if (!configurationName.HasValue) { return(null); } tableType = TableType.Main; descriptor = MetadataHelpers.GetDescriptorOrNull(configurationName.Value.Scope); if (descriptor == null) { comObject = null; } else { var configurationItem = globalContext.FindMetaByName(configurationName.Value); comObject = configurationItem.ComObject; } } else if (purpose == "ТабличнаяЧасть") { descriptor = MetadataHelpers.tableSectionDescriptor; var fullname = TableSectionQueryNameToFullName(queryTableName); comObject = ComHelpers.Invoke(globalContext.Metadata, "НайтиПоПолномуИмени", fullname); if (comObject == null) { return(null); } tableType = TableType.TableSection; } else { return(null); } var propertyDescriptors = comObject == null ? new Dictionary <string, string[]>() : MetadataHelpers.GetAttributes(comObject, descriptor) .ToDictionary(Call.Имя, GetConfigurationTypes); var propertyMappings = new ValueTable(tableRow["Поля"]) .Select(x => new { queryName = x.GetString("ИмяПоля"), dbName = x.GetString("ИмяПоляХранения") }) .Where(x => !string.IsNullOrEmpty(x.queryName)) .Where(x => !string.IsNullOrEmpty(x.dbName)) .GroupBy(x => x.queryName, (x, y) => new { queryName = x, columns = y.Select(z => z.dbName).ToArray() }, StringComparer.OrdinalIgnoreCase) .Select(x => { var propertyName = x.queryName.ExcludeSuffix("Кт").ExcludeSuffix("Дт"); var propertyTypes = propertyName == "Счет" ? new[] { "ПланСчетов.Хозрасчетный" } : propertyDescriptors.GetOrDefault(propertyName); if (propertyTypes == null || propertyTypes.Length == 1) { if (x.columns.Length != 1) { return(null); } var nestedTableName = propertyTypes == null ? null : propertyTypes[0]; var singleLayout = new SingleLayout(x.columns[0], nestedTableName); return(new PropertyMapping(x.queryName, singleLayout, null)); } var unionLayout = x.queryName == "Регистратор" ? new UnionLayout( null, GetColumnBySuffixOrNull("_RecorderTRef", x.columns), GetColumnBySuffixOrNull("_RecorderRRef", x.columns), propertyTypes) : new UnionLayout( GetColumnBySuffixOrNull("_type", x.columns), GetColumnBySuffixOrNull("_rtref", x.columns), GetColumnBySuffixOrNull("_rrref", x.columns), propertyTypes); return(new PropertyMapping(x.queryName, null, unionLayout)); }) .NotNull() .ToList(); if (tableType == TableType.TableSection) { if (!HasProperty(propertyMappings, PropertyNames.id)) { var refLayout = new SingleLayout(GetTableSectionIdColumnNameByTableName(dbTableName), null); propertyMappings.Add(new PropertyMapping(PropertyNames.id, refLayout, null)); } if (!HasProperty(propertyMappings, PropertyNames.area)) { var mainQueryName = TableMapping.GetMainQueryNameByTableSectionQueryName(queryTableName); TableMapping mainTableMapping; if (!tableMappingByQueryName.TryGetValue(mainQueryName, out mainTableMapping)) { return(null); } PropertyMapping mainAreaProperty; if (!mainTableMapping.TryGetProperty(PropertyNames.area, out mainAreaProperty)) { return(null); } propertyMappings.Add(mainAreaProperty); } } return(new TableMapping(queryTableName, dbTableName, tableType, propertyMappings.ToArray())); }
public static object Получить(object comObject, int index) { return(ComHelpers.Invoke(comObject, "Получить", index)); }
private void SaveProperty(string name, object value, object comObject, Stack <object> pending, Metadata metadata) { var list = value as IList; if (list != null) { var tableSection = ComHelpers.GetProperty(comObject, name); ComHelpers.Invoke(tableSection, "Очистить"); foreach (Abstract1CEntity item in (IList)value) { Save(item, ComHelpers.Invoke(tableSection, "Добавить"), pending); } return; } var syncList = value as SyncList; if (syncList != null) { var tableSection = ComHelpers.GetProperty(comObject, name); foreach (var cmd in syncList.Commands) { switch (cmd.CommandType) { case SyncList.CommandType.Delete: var deleteCommand = (SyncList.DeleteCommand)cmd; ComHelpers.Invoke(tableSection, "Удалить", deleteCommand.index); break; case SyncList.CommandType.Insert: var insertCommand = (SyncList.InsertCommand)cmd; var newItemComObject = ComHelpers.Invoke(tableSection, "Вставить", insertCommand.index); pending.Push(insertCommand.index); Save(insertCommand.item, newItemComObject, pending); pending.Pop(); break; case SyncList.CommandType.Move: var moveCommand = (SyncList.MoveCommand)cmd; ComHelpers.Invoke(tableSection, "Сдвинуть", moveCommand.from, moveCommand.delta); break; case SyncList.CommandType.Update: var updateCommand = (SyncList.UpdateCommand)cmd; pending.Push(updateCommand.index); Save(updateCommand.item, Call.Получить(tableSection, updateCommand.index), pending); pending.Pop(); break; default: throw new ArgumentOutOfRangeException(); } } return; } object valueToSet; var abstractEntity = value as Abstract1CEntity; if (abstractEntity != null) { Save(abstractEntity, null, pending); valueToSet = abstractEntity.Controller.ValueSource.GetBackingStorage(); } else { if (metadata != null && value != null) { metadata.Validate(name, value); } valueToSet = comObjectMapper.MapTo1C(value); } ComHelpers.SetProperty(comObject, name, valueToSet); }
public static object НайтиПоТипу(object metadata, object typeObject) { return(ComHelpers.Invoke(metadata, "НайтиПоТипу", typeObject)); }
private static string GetFullName(object source) { var metadata = ComHelpers.Invoke(source, "Метаданные"); return(Call.ПолноеИмя(metadata)); }