Пример #1
0
        public bool Exist(string id, DateTime timePoint)
        {
            id.NullCheck("id");

            InSqlClauseBuilder inBuilder = new InSqlClauseBuilder("ID");

            inBuilder.AppendItem(id);

            DESchemaObjectCollection objs = Load(inBuilder, timePoint, false);

            return(objs.Any());
        }
Пример #2
0
        /// <summary>
        /// 根据ID和时间载入对象
        /// </summary>
        /// <param name="id">对象的ID</param>
        /// <param name="timePoint">表示时间点的<see cref="DateTime"/> 或 <see cref="DateTime.MinValue"/>表示当前时间</param>
        /// <returns><see cref="DESchemaObjectBase"/>的派生类型的实例</returns>
        public DESchemaObjectBase Load(string id, DateTime timePoint, bool loadNormalStatus = true)
        {
            id.NullCheck("id");

            InSqlClauseBuilder inBuilder = new InSqlClauseBuilder("ID");

            inBuilder.AppendItem(id);

            DESchemaObjectCollection objs = Load(inBuilder, timePoint, loadNormalStatus);

            if (!objs.Any())
            {
                throw new Exception(string.Format("{0}不能找到ID为{1}的对象", (timePoint == DateTime.MinValue ? string.Empty : string.Format("在{0}时间下", timePoint.ToString("yyyy-MM-dd HH:mm:ss"))), id));
            }

            return(objs.Single());
        }