protected virtual WhereSqlClauseBuilder PrepareWhereSqlBuilder(T obj, ORMappingItemCollection mapping) { WhereSqlClauseBuilder primaryKeyBuilder = ORMapping.GetWhereSqlClauseBuilderByPrimaryKey(obj); string vsFieldName = GetPropertyFieldName("VersionStartTime", mapping); if (primaryKeyBuilder.Exists(item => ((SqlClauseBuilderItemIUW)item).DataField == vsFieldName) == false) { primaryKeyBuilder.AppendItem(vsFieldName, obj.VersionStartTime); } return(primaryKeyBuilder); }
/// <summary> /// 准备Where的子句,填写了VersionStartTime。在插入操作时,VST应该是MinValue。否则应该是最后一条记录的时间 /// </summary> /// <param name="obj"></param> /// <param name="mapping"></param> /// <param name="builder"></param> /// <returns></returns> private IConnectiveSqlClause ModifyTimeFieldsInWhereBuilder(T obj, ORMappingItemCollection mapping, WhereSqlClauseBuilder builder) { string startTimeFieldName = GetPropertyFieldName("VersionStartTime", mapping); string endTimeFieldName = GetPropertyFieldName("VersionEndTime", mapping); if (builder.Exists(item => ((SqlClauseBuilderItemIUW)item).DataField == startTimeFieldName) == false) { builder.AppendItem(startTimeFieldName, obj.VersionStartTime); } builder.Remove(b => ((SqlClauseBuilderItemIUW)b).DataField == endTimeFieldName); builder.AppendItem(endTimeFieldName, DBTimePointActionContext.MaxVersionEndTime); return(builder); }