示例#1
0
        private static CdcTableTypeModel HandleContentDataTableTypeDataModifier(CdcTableTypeModel prevInSortOrder, CdcTableTypeModel nextInSortOrder)
        {
            var result = Mapper.Map <CdcTableTypeModel, CdcTableTypeModel>(nextInSortOrder);

            if (result.Action == CdcOperationType.Update)
            {
                if (prevInSortOrder.Action == CdcOperationType.Insert)
                {
                    result.Action = CdcOperationType.Insert;
                }

                if (prevInSortOrder.Action == CdcOperationType.Insert || prevInSortOrder.Action == CdcOperationType.Update)
                {
                    foreach (var col in prevInSortOrder.Entity.Columns)
                    {
                        if (!result.Entity.Columns.ContainsKey(col.Key))
                        {
                            result.Entity.Columns.Add(col);
                        }
                    }
                }
            }

            return(result);
        }
示例#2
0
        private static CdcTableTypeModel HandleSimpleTableTypeDataModifier(CdcTableTypeModel prevInSortOrder, CdcTableTypeModel nextInSortOrder)
        {
            var result = Mapper.Map <CdcTableTypeModel, CdcTableTypeModel>(nextInSortOrder);

            if (result.Action == CdcOperationType.Update && prevInSortOrder.Action == CdcOperationType.Insert)
            {
                result.Action = CdcOperationType.Insert;
            }

            return(result);
        }
        internal static CdcTableTypeModel ConvertItemToItemToRev(CdcTableTypeModel model)
        {
            Ensure.Not((bool)model.Entity.MetaData[TarantoolItemToItemModel.IsRev]);

            var proto = Mapper.Map <CdcTableTypeModel, CdcTableTypeModel>(model);

            proto.Entity.Columns[TarantoolItemToItemModel.Id]       = model.Entity.Columns[TarantoolItemToItemModel.LinkedId];
            proto.Entity.Columns[TarantoolItemToItemModel.LinkedId] = model.Entity.Columns[TarantoolItemToItemModel.Id];
            proto.Entity.InvariantName = TarantoolItemToItemModel.GetInvariantName((decimal)proto.Entity.MetaData[TarantoolItemToItemModel.LinkId], true);

            return(proto);
        }