Пример #1
0
        /// <summary>检查在指定时间后更新过的数据</summary>
        /// <param name="last"></param>
        /// <param name="start"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        public virtual ISyncMasterEntity[] GetAllUpdated(DateTime last, Int32 start, Int32 max)
        {
            var name = LastUpdateName;

            var where = String.IsNullOrEmpty(name) ? null : Facotry.MakeCondition(LastUpdateName, last, ">");
            var list = Facotry.FindAll(where, null, null, start, max);

            if (list == null || list.Count < 1)
            {
                return(null);
            }

            // 如果实体类实现了该接口,则返回
            if (Facotry.Default is ISyncMasterEntity)
            {
                var rs = new ISyncMasterEntity[list.Count];
                for (int i = 0; i < list.Count; i++)
                {
                    rs[i] = list[i] as ISyncMasterEntity;
                }
                return(rs);
            }
            // 否则采用内置实现
            else
            {
                var rs = new ISyncMasterEntity[list.Count];
                for (int i = 0; i < list.Count; i++)
                {
                    rs[i] = new SyncMasterEntity(this, list[i]);
                }
                return(rs);
            }
        }
Пример #2
0
        /// <summary>检查在指定时间后更新过的数据</summary>
        /// <param name="last"></param>
        /// <param name="start"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        public virtual ISyncMasterEntity[] GetAllUpdated(DateTime last, Int32 start, Int32 max)
        {
            FieldItem fi = Facotry.Table.FindByName(LastUpdateName);

            //var where = fi == null ? null : fi > last;
            var where = new WhereExpression();
            if (fi != null)
            {
                where &= fi > last;
            }
            var list = Facotry.FindAll(where, null, null, start, max);

            if (list == null || list.Count < 1)
            {
                return(null);
            }

            // 如果实体类实现了该接口,则返回
            if (Facotry.Default is ISyncMasterEntity)
            {
                var rs = new ISyncMasterEntity[list.Count];
                for (var i = 0; i < list.Count; i++)
                {
                    rs[i] = list[i] as ISyncMasterEntity;
                }
                return(rs);
            }
            // 否则采用内置实现
            else
            {
                var rs = new ISyncMasterEntity[list.Count];
                for (var i = 0; i < list.Count; i++)
                {
                    rs[i] = new SyncMasterEntity(this, list[i]);
                }
                return(rs);
            }
        }