/// <summary> /// /// </summary> /// <param name="inCondition"></param> /// <param name="action"></param> /// <param name="timePoint"></param> /// <param name="tableName"></param> /// <param name="mappings"></param> public void LoadByInBuilderInContext(InLoadingCondition inCondition, Action <TCollection> action, DateTime timePoint, string tableName = null, ORMappingItemCollection mappings = null) { inCondition.NullCheck("inCondition"); inCondition.BuilderAction.NullCheck("BuilderAction"); InSqlClauseBuilder inBuilder = new InSqlClauseBuilder(inCondition.DataField); inCondition.BuilderAction(inBuilder); string condition = string.Empty; if (inBuilder.IsEmpty == false) { ConnectiveSqlClauseCollection builder = new ConnectiveSqlClauseCollection(LogicOperatorDefine.And, inBuilder, new WhereSqlClauseBuilder().AppendTenantCode(typeof(T))); condition = builder.ToSqlString(TSqlBuilder.Instance); OrderBySqlClauseBuilder orderByBuilder = null; if (inCondition.OrderByAction != null) { orderByBuilder = new OrderBySqlClauseBuilder(); inCondition.OrderByAction(orderByBuilder); } this.RegisterLoadByBuilderInContext(condition, orderByBuilder, action, timePoint, tableName, mappings); } }
/// <summary> /// /// </summary> /// <param name="inCondition"></param> /// <param name="mappings"></param> /// <returns></returns> public TCollection LoadByInBuilder(InLoadingCondition inCondition, ORMappingItemCollection mappings = null) { inCondition.NullCheck("inCondition"); inCondition.BuilderAction.NullCheck("BuilderAction"); if (mappings == null) { mappings = this.GetQueryMappingInfo(); } TCollection result = default(TCollection); PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration(string.Format("LoadByInBuilder({0})", this.GetType().FullName), () => { InSqlClauseBuilder inBuilder = new InSqlClauseBuilder(inCondition.DataField); inCondition.BuilderAction(inBuilder); string condition = string.Empty; if (inBuilder.IsEmpty == false) { ConnectiveSqlClauseCollection builder = new ConnectiveSqlClauseCollection(LogicOperatorDefine.And, inBuilder, new WhereSqlClauseBuilder().AppendTenantCode(typeof(T))); condition = builder.ToSqlString(TSqlBuilder.Instance); OrderBySqlClauseBuilder orderByBuilder = null; if (inCondition.OrderByAction != null) { orderByBuilder = new OrderBySqlClauseBuilder(); inCondition.OrderByAction(orderByBuilder); } result = InnerLoadByBuilder(condition, orderByBuilder, mappings); } else { result = new TCollection(); } }); return(result); }