コード例 #1
0
        private EntityTable TakeRegistedTable(EntityTable srcTable)
        {
            EntityTable table;
            string      key = GenKey(srcTable);

            if (!updatingTables.TryGetValue(key, out table))
            {
                //by feng 100/08/26 ,此處應該不需作Clone,若改回則須同時改回Common.DataCore.EntityExtension.GroupToTables()
                //之tableAttributes.KeyCount = maxKeyCount;
                //table = srcTable.Clone(false);
                table = srcTable;
                updatingTables[key] = table;
            }
            else
            {
                if (!srcTable.GetAttributesEntity().IsPartial)
                {//置換,但不能做    Uuregist把CollectionChanged event移除
                    updatingTables[key] = srcTable;
                }
                else
                {
                    //Add by Feng 100/08/25
                    table.GetAttributesEntity().KeyCount = srcTable.GetAttributesEntity().KeyCount;
                }
            }
            return(table);
        }
コード例 #2
0
        /// <summary>
        /// 登錄到記憶體中
        /// </summary>
        /// <param name="entityTable"></param>
        public void Regist(EntityTable entityTable, OPStatus opStatus)
        {
            //if (entityTable == null) return;
            if (entityTable == null || (opStatus == OPStatus.Steady && entityTable.HasCollectionChangedEventSubscriber()))
            {
                return;
            }
            if (opStatus.IsPassSchema())
            {
                entityTable.GetAttributesEntity().Status = opStatus;
                updatingTables[GenKey(entityTable, true)] = entityTable;
                return;
            }

            //if(HasCollectionChangedEventSubscriber())
            var attris = entityTable.GetAttributesEntity();

            attris.Status = opStatus;
            entityTable.CollectionChanged -= OnTableCollectionChanged;
            entityTable.CollectionChanged += OnTableCollectionChanged;
            //Comment out: 每次因EntityTable的rows可能數量不同,有的是部分
            //if (!attris.IsPartial&&updatingTables.ContainsKey(GenKey(entityTable)))
            //    return;
            Action <EntityRow> action = delegate(EntityRow row)
            {
                var attribute = row.GetAttributesEntity();
                //attribute.Status = opStatus;
                row.PropertyChanged -= OnRowChanged;
                row.PropertyChanged += OnRowChanged;
            };
            EntityTable registedTable = TakeRegistedTable(entityTable);

            entityTable.Rows.ForEach(row => { action(row); DoRegist(registedTable, row, opStatus); });
        }