当前位置: 首页>>代码示例>>C#>>正文


C# IServiceProvider.MaxInClauseElements方法代码示例

本文整理汇总了C#中IServiceProvider.MaxInClauseElements方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceProvider.MaxInClauseElements方法的具体用法?C# IServiceProvider.MaxInClauseElements怎么用?C# IServiceProvider.MaxInClauseElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IServiceProvider的用法示例。


在下文中一共展示了IServiceProvider.MaxInClauseElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetMsgGroupReadReplies

		private static void SetMsgGroupReadReplies(
			IServiceProvider provider,
			IEnumerable<int> mids,
			bool readReplies)
		{
			if (mids == null)
				throw new ArgumentNullException(nameof(mids));

			using (var db = provider.CreateDBContext())
			using (var tx = db.BeginTransaction())
			{
				foreach (var ids in mids.SplitToSeries(provider.MaxInClauseElements()))
				{
					var localIds = ids;
					db
						.Messages(m => localIds.Contains(m.ID))
						.Set(_ => _.ReadReplies, readReplies)
						.Update();
				}
				tx.Commit();
			}
		}
开发者ID:rsdn,项目名称:janus,代码行数:22,代码来源:ForumHelper.cs

示例2: UpdateTopicInfoRange

		public static void UpdateTopicInfoRange(
			IServiceProvider provider,
			IDataContext db,
			IEnumerable<int> tids)
		{
			if (db == null)
				throw new ArgumentNullException("db");
			if (tids == null)
				return;

			foreach (var series in
					tids
						.SplitToSeries(provider.MaxInClauseElements()))
			{
				var locSeries = series;
				UpdateTopicInfoByFilter(
					db,
					ti => locSeries.Contains(ti.MessageID),
					m => locSeries.Contains(m.ID));
			}
		}
开发者ID:rsdn,项目名称:janus,代码行数:21,代码来源:DatabaseManager.Aggregates.cs

示例3: SearchMessagesByLucene

		/// <summary>
		/// Поиск и выборка данных с использованием Lucene
		/// </summary>
		public static List<MsgBase> SearchMessagesByLucene(
			IServiceProvider provider,
			int forumId,
			string searchText,
			bool searchInText,
			bool searchInSubject,
			bool searchAuthor,
			bool searchInMarked,
			bool searchInMyMessages,
			bool searchAnyWords,
			bool searchInQuestions,
			DateTime from,
			DateTime to)
		{
			provider.LogInfo("Начат поиск...");
			var maxInClause = provider.MaxInClauseElements();

			provider.LogInfo("Используется lucene...");

			var mids =
				Search(
					forumId,
					searchText,
					searchInText,
					searchInSubject,
					searchAuthor,
					//searchInMarked,
					searchInMyMessages,
					searchAnyWords,
					//searchInQuestions,
					from,
					to);

			if (mids.Count == 0)
				return new List<MsgBase>(); // Ничего не нашли, вернём пустой список

			if (mids.Count > maxInClause)
				mids = Algorithms.GetFirstElements(mids, maxInClause);
			var intMids = mids.Select(int.Parse);

			using (var db = provider.CreateDBContext())
			{
				var q = db.Messages(m => intMids.Contains(m.ID));
				q = q.OrderByDescending(m => m.ID);

				// Обработка вопросов
				if (searchInQuestions)
					q = q.Where(m => m.TopicID == 0);

				// Обработка пометок пользователя
				if (searchInMarked)
					q = q.Where(m => m.IsMarked);

				var maxResults = Config.Instance.SearchConfig.MaxResultInSelect;
				if (maxResults > 0)
					q = q.Take(maxResults);

				var msgTable = db.Messages();
				var msgs =
					q
						.Select(
							m =>
								new LinearTreeMsg(provider)
								{
									ID = m.ID,
									ForumID = m.ForumID,
									TopicIDInternal = m.TopicID,
									ParentID = m.ParentID,
									Date = m.Date,
									UserID = m.UserID,
									UserNick = m.UserNick,
									UserClass = (short)m.UserClass,
									Subject = m.Subject,
									IsRead = m.IsRead,
									Rating = m.Rating(),
									Smiles = m.SmileCount(),
									Agrees = m.AgreeCount(),
									Disagrees = m.DisagreeCount(),
									RepliesCount = msgTable.Count(im => im.ParentID == m.ID),
								});
				var list =
					msgs
						.Cast<MsgBase>()
						.ToList();
				foreach (var msg in list)
					msg.EndMapping();
				return list;
			}
		}
开发者ID:rsdn,项目名称:janus,代码行数:92,代码来源:SearchHelper.cs


注:本文中的IServiceProvider.MaxInClauseElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。