Example #1
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);
        }
        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));
        }
        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));
        }