All LINQ Examples are executed using the same TemplateContext instance below:

    LinqContext = new TemplateContext {
        Args = {
            [TemplateConstants.DefaultDateFormat] = "yyyy/MM/dd",
            ["products"] = TemplateQueryData.Products,
            ["customers"] = TemplateQueryData.Customers,
            ["comparer"] = new CaseInsensitiveComparer(),
            ["anagramComparer"] = new AnagramEqualityComparer(),

Which makes available the products and customer data sources to each template, all other data sources are created within the template that uses them.

The comparer and anagramComparer are examples of custom .NET objects the templates can't create themselves so they need to defined externally so they're available to the LINQ examples that need them.

The Args[DefaultDateFormat] changes the default format the dateFormat filter uses if none is provided.

made with by ServiceStack