Exemplo n.º 1
0
        protected DataUpdatingEventArgs OnUpdating(object data, ICondition condition, string scope)
        {
            var args = new DataUpdatingEventArgs(this.Name, DataDictionary <TEntity> .GetDataDictionary(data), condition, scope);

            this.OnUpdating(args);
            return(args);
        }
Exemplo n.º 2
0
        protected DataInsertingEventArgs OnInserting(object data, string scope)
        {
            var args = new DataInsertingEventArgs(this.Name, DataDictionary <TEntity> .GetDataDictionary(data), scope);

            //尝试递增注册的递增键值
            DataSequence.Increments(this, (DataDictionary <TEntity>)args.Data);

            this.OnInserting(args);
            return(args);
        }
Exemplo n.º 3
0
        public int Insert(object data, string scope, object state)
        {
            if (data == null)
            {
                return(0);
            }

            //将当前插入数据实体对象转换成数据字典
            var dictionary = DataDictionary <TEntity> .GetDataDictionary(data);

            //尝试递增注册的递增键值
            DataSequence.Increments(this, dictionary);

            return(this.OnInsert(dictionary, scope, state));
        }
Exemplo n.º 4
0
        public int Update(object data, ICondition condition = null, string scope = null)
        {
            //激发“Updating”事件
            var args = this.OnUpdating(data, condition, scope);

            if (args.Cancel)
            {
                return(args.Result);
            }

            //执行数据更新操作
            args.Result = this.OnUpdate(DataDictionary <TEntity> .GetDataDictionary(args.Data), args.Condition, args.Scope);

            //激发“Updated”事件
            return(this.OnUpdated(args.Data, args.Condition, args.Scope, args.Result));
        }
Exemplo n.º 5
0
        public int Insert(object data, string scope = null)
        {
            //激发“Inserting”事件
            var args = this.OnInserting(data, scope);

            if (args.Cancel)
            {
                return(args.Result);
            }

            //执行数据插入操作
            args.Result = this.OnInsert(DataDictionary <TEntity> .GetDataDictionary(args.Data), args.Scope);

            //激发“Inserted”事件
            return(this.OnInserted(args.Data, args.Scope, args.Result));
        }
Exemplo n.º 6
0
 public int Update(object data, ICondition condition, string scope, object state = null)
 {
     return(this.OnUpdate(DataDictionary <TEntity> .GetDataDictionary(data), condition, scope, state));
 }