Ejemplo n.º 1
0
        /// <summary>
        /// 检查是否有绑定事件,防止没有绑定导致数据丢失
        /// </summary>
        /// <param name="data"></param>
        private void CheckEventBind(AbstractEntity data)
        {
            if (data == null || data.IsReadOnly)
            {
                return;
            }
            var schema = data.GetSchema();

            if (!schema.HasObjectColumns)
            {
                return;
            }

            var columns = schema.GetObjectColumns();

            foreach (var column in columns)
            {
                var temp = data.GetPropertyValue(column.Name) as IItemChangeEvent;
                if (temp != null && temp.ItemEvent.Parent == null)
                {
                    temp.PropertyName = column.Name;
                    data.AddChildrenListener(temp);
                    temp.IsInCache = true;
                }
            }
        }