Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Mvc.PagedList/Internal/DefaultPagerRenderingListGenerator.cs
/// <summary>
///     Generate a <see cref="PagerRenderingList" /> for a series of <see cref="PagerItem" />.
/// </summary>
/// <param name="items">The collection of <see cref="PagerItem" /> which are included in the list.</param>
/// <param name="context">The generation context.</param>
/// <returns>The generated <see cref="PagerRenderingList" /> instance.</returns>
Generate a  for a series of .
Generate a for a series of .
private PagerRenderingList GenerateRenderingListCore(IEnumerable<PagerItem> items, PagerGenerationContext context)
		{
			var optionsCache = new Dictionary<PagerItemType, PagerItemOptions>();
			var renderingItemList = new List<PagerRenderingItem>();
			var result = new PagerRenderingList
			{
				Settings = new Dictionary<string, string>(context.Options.AdditionalSettings)
			};
			foreach (var item in items)
			{
				if (!optionsCache.TryGetValue(item.ItemType, out var itemOptions))
				{
					itemOptions = context.Options.ItemOptions.GetMergedOptionsFor(item);
					optionsCache[item.ItemType] = itemOptions;
				}
				var itemContext = new PagerItemGenerationContext(context, item, itemOptions);
				var renderingItem = GenerateRenderingItem(result, itemContext);
				renderingItemList.Add(renderingItem);
			}
			result.Items = new ReadOnlyCollection<PagerRenderingItem>(renderingItemList);
			return result;
		}
private PagerRenderingList GenerateRenderingListCore ( IEnumerable < PagerItem > items , PagerGenerationContext context ) { var optionsCache = new Dictionary < PagerItemType , PagerItemOptions > ( ) ; var renderingItemList = new List < PagerRenderingItem > ( ) ; var result = new PagerRenderingList { Settings = new Dictionary < string , string > ( context . Options . AdditionalSettings ) } ; foreach ( var item in items ) { if ( ! optionsCache . TryGetValue ( item . ItemType , out var itemOptions ) ) { itemOptions = context . Options . ItemOptions . GetMergedOptionsFor ( item ) ; optionsCache [ item . ItemType ] = itemOptions ; } var itemContext = new PagerItemGenerationContext ( context , item , itemOptions ) ; var renderingItem = GenerateRenderingItem ( result , itemContext ) ; renderingItemList . Add ( renderingItem ) ; } result . Items = new ReadOnlyCollection < PagerRenderingItem > ( renderingItemList ) ; return result ; }
Generate a  for a series of .
Generate a for a series of .
// Owner // Try to get cached options, or create a new option instance // Generate item context // Generate item and add to list // Result
The generated  instance.
The generated instance .
items
IEnumerable<PagerItem>
The collection of  which are included in the list.
The collection of which are included in the list .
context
PagerGenerationContext
The generation context.
The generation context .