Ejemplo n.º 1
0
        protected DataManyUpdatingEventArgs OnManyUpdating(object data, ICondition condition, string scope)
        {
            var args = new DataManyUpdatingEventArgs(this.Name, DataDictionary <TEntity> .GetDataDictionaries(data), condition, scope);

            this.OnManyUpdating(args);
            return(args);
        }
Ejemplo n.º 2
0
        public int UpdateMany(IEnumerable data, ICondition condition = null, string scope = null)
        {
            //激发“Updating”事件
            var args = this.OnUpdating(data, condition, scope);

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

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

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

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

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

            //激发“Inserted”事件
            return(this.OnInserted(args.Data, args.Scope, args.Result));
        }
Ejemplo n.º 4
0
        public int InsertMany(IEnumerable data, string scope, object state)
        {
            if (data == null)
            {
                return(0);
            }

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

            foreach (var dictionary in dictionares)
            {
                //尝试递增注册的递增键值
                DataSequence.Increments(this, dictionary);
            }

            return(this.OnInsertMany(dictionares, scope, state));
        }
Ejemplo n.º 5
0
 public int UpdateMany(IEnumerable items, string scope, object state = null)
 {
     return(this.OnUpdateMany(DataDictionary <TEntity> .GetDataDictionaries(items), scope, state));
 }