public Func <Task> GetSectionDelegate(string name) { TkDebug.AssertArgumentNullOrEmpty(name, nameof(name), this); SectionWriters.TryGetValue(name, out var result); return(result); }
public void DefineSection(string name, SectionWriter action) { if (SectionWriters.ContainsKey(name)) { throw new HttpException(String.Format(CultureInfo.InvariantCulture, WebPageResources.WebPage_SectionAleadyDefined, name)); } SectionWriters[name] = action; }
public void DefineSection(string name, SectionWriter action) { if (SectionWriters.ContainsKey(name)) { throw new HttpException(String.Format("WebPageResources.WebPage_SectionAleadyDefined {0}", name)); } SectionWriters[name] = action; }
/// <summary> /// Creates a named content section in the page that can be invoked in a Layout page using /// <see cref="RenderSection(string)"/> or <see cref="RenderSectionAsync(string, bool)"/>. /// </summary> /// <param name="name">The name of the section to create.</param> /// <param name="section">The <see cref="RenderAsyncDelegate"/> to execute when rendering the section.</param> public void DefineSection([NotNull] string name, [NotNull] RenderAsyncDelegate section) { if (SectionWriters.ContainsKey(name)) { throw new InvalidOperationException(Resources.FormatSectionAlreadyDefined(name)); } SectionWriters[name] = section; }
public void RenderSection(string name) { if (!SectionWriters.ContainsKey(name)) { return; } var section = SectionWriters[name]; section(builder); }
public void DefineSection(string name, Func <Task> section) { TkDebug.AssertArgumentNullOrEmpty(name, nameof(name), this); TkDebug.AssertArgumentNull(section, nameof(section), this); if (SectionWriters.ContainsKey(name)) { throw new InvalidOperationException(); } SectionWriters[name] = section; }
/// <summary> /// Creates a named content section in the page that can be invoked in a Layout page using /// <see cref="RenderSection(string)"/> or <see cref="RenderSectionAsync(string, bool)"/>. /// </summary> /// <param name="name">The name of the section to create.</param> /// <param name="section">The <see cref="RenderAsyncDelegate"/> to execute when rendering the section.</param> public override void DefineSection(string name, RenderAsyncDelegate section) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (section == null) { throw new ArgumentNullException(nameof(section)); } if (SectionWriters.ContainsKey(name)) { throw new InvalidOperationException($"Section {name} is already defined"); } SectionWriters[name] = section; }
/// <summary> /// Creates a named content section in the page that can be invoked in a Layout page using /// <c>RenderSection</c> or <c>RenderSectionAsync</c> /// </summary> /// <param name="name">The name of the section to create.</param> /// <param name="section">The <see cref="RenderAsyncDelegate"/> to execute when rendering the section.</param> public virtual void DefineSection(string name, RenderAsyncDelegate section) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (section == null) { throw new ArgumentNullException(nameof(section)); } if (SectionWriters.ContainsKey(name)) { throw new InvalidOperationException(); } SectionWriters[name] = section; }
/// <summary> /// Creates a named content section in the page that can be invoked in a Layout page using /// <see cref="RenderSection(string)"/> or <see cref="RenderSectionAsync(string, bool)"/>. /// </summary> /// <param name="name">The name of the section to create.</param> /// <param name="section">The <see cref="RenderAsyncDelegate"/> to execute when rendering the section.</param> public void DefineSection(string name, RenderAsyncDelegate section) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (section == null) { throw new ArgumentNullException(nameof(section)); } if (SectionWriters.ContainsKey(name)) { throw new InvalidOperationException(Resources.FormatSectionAlreadyDefined(name)); } SectionWriters[name] = section; }
public Component MountAsPage(string populateElementRef) { SectionWriters.Clear(); return(Mount(populateElementRef, replace: false, enableLayouts: true)); }
public bool IsSectionDefined(string name) { TkDebug.AssertArgumentNullOrEmpty(name, nameof(name), this); return(SectionWriters.ContainsKey(name)); }