ERROR Rendering ControlErrors while compiling a Template.
Please try the following to solve the situation:
* If the problem is about missing/invalid references or multiple defines either try to load
the missing references manually (in the compiling appdomain!) or
Specify your references manually by providing your own IReferenceResolver implementation.
See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details.
Currently all references have to be available as files!
* If you get 'class' does not contain a definition for 'member':
try another modelType (for example 'null' to make the model dynamic).
NOTE: You CANNOT use typeof(dynamic) to make the model dynamic!
Or try to use static instead of anonymous/dynamic types.
More details about the error:
- error: (34, 45) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Assets' and no extension method 'Assets' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (55, 39) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Path' and no extension method 'Path' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (56, 30) 'System.Collections.Generic.List' does not contain a definition for 'FirstOrDefault' and the best extension method overload 'System.Linq.Enumerable.FirstOrDefault(System.Collections.Generic.IEnumerable, System.Func)' has some invalid arguments
- error: (56, 61) Argument 2: cannot convert from 'lambda expression' to 'System.Func'
- error: (96, 91) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (99, 91) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (105, 93) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (546, 97) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (549, 131) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (559, 205) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (562, 239) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (572, 327) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
- error: (575, 361) 'System.Collections.Generic.IEnumerable' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)
Temporary files of the compilation can be found in (please delete the folder): C:\Windows\TEMP\RazorEngine_dxivxgp3.gau
The template we tried to compile is:
------------- START -----------
@{
var category = @Model.Model;
var bomProductAssets = category.Assets;
var allAssets = bomProductAssets.Where(d => !d.Metadata.ContainsKey("isPublic") || bool.Parse(d.Metadata["isPublic"].ToString()))
.OrderByDescending(o => o.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(o.Metadata["PublicationDate"].ToString()) : DateTime.MinValue);
var specs = allAssets.Where(d => d.Metadata.ContainsKey("manualType") && d.Metadata["manualType"].ToString().Equals("advanced specs",StringComparison.OrdinalIgnoreCase));
var manuals = allAssets.Where(d => d.Metadata.ContainsKey("manualType")
&& (d.Metadata["manualType"].ToString().Equals("Operator's Manual",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Parts Manual",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Superseded Parts Listing",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Technical Manual",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Installation Manuals",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Callout Drawing",StringComparison.OrdinalIgnoreCase)));
var guides = allAssets.Where(d => d.Metadata.ContainsKey("manualType") && d.Metadata["manualType"].ToString().Equals("Troubleshooting Guide",StringComparison.OrdinalIgnoreCase));
var diagrams = allAssets.Where(d => d.Metadata.ContainsKey("manualType")
&& (d.Metadata["manualType"].ToString().Equals("Wiring Diagram",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Installation Diagrams",StringComparison.OrdinalIgnoreCase)
));
var bulletins = allAssets.Where(d => d.Metadata.ContainsKey("manualType")
&& (d.Metadata["manualType"].ToString().Equals("Service Bulletin",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Parts Bulletin",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Product Recall",StringComparison.OrdinalIgnoreCase)));
var breadcrumbPages = "5399ada1daf73a26740bf60b|Low-CO EFI Gasoline Generators|low-coefigasolinegenerators.htm,5399ada1daf73a26740bf60c|Carbureted Gasoline Generators|carburetedgasolinegenerators.htm,5399ada1daf73a26740bf60d|Electronic Diesel Generators|electronicdieselgenerators.htm,5399ada1daf73a26740bf60e|Diesel Generators|traditionaldieselgenerators.htm,5399ada1daf73a26740bf60f|Westerbeke Engines|westerbekeengines.htm,5399ada1daf73a26740bf610|Climate Control|climatecontrol.htm,5399ada1daf73a26740bf611|Gasoline Engines|westerbekeengines.htm,5399ada1daf73a26740bf612|Industrial Generators|industrialgenerators.htm,5399ada1daf73a26740bf613|Sound Guards|soundguards.htm,5399ada1daf73a26740bf614|Universal Engines|universalengines.htm,5399ada1daf73a26740bf615|Westerbeke Engines|westerbekeengines.htm".Split(',').ToList();
var parentPage = category.Path[1].ToString().ToLowerInvariant();
var breadCrumb = breadcrumbPages.FirstOrDefault(x => x.Contains(parentPage));
var landingPage = breadCrumb.Split('|')[2];
var landingPageName = breadCrumb.Split('|')[1];
}
- Home
- @landingPageName
- @category.Name
- Technical Documents
Technical Documents
Important Note: Technical information is provided on our website for your reference and convenience. Westerbeke recommends that your engine, generator or climate control system is serviced and/or installed only by an authorized Westerbeke distributor or dealer. Click here to locate the Master Distributor or Dealer for your area.
Advanced Specifications
@if (specs.Any())
{
}
@foreach (var spec in specs)
{
var pubDate = spec.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(spec.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
}
@if (!specs.Any())
{
}
Document Name |
Publication Date |
@(spec.DocumentTitle ?? spec.FullName) |
@pubDate |
No matching records found |
Manuals (Operators, Parts, Technical, Installation)
@if (manuals.Any())
{
}
@foreach (var man in manuals)
{
var pubDate = man.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(man.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
}
@if (!manuals.Any())
{
}
Document Name |
Publication Date |
@(man.DocumentTitle ?? man.FullName) |
@pubDate |
No matching records found |
Guides (Troubleshooting)
@if (guides.Any())
{
}
@foreach (var guide in guides)
{
var pubDate = guide.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(guide.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
}
@if (!guides.Any())
{
}
Document Name |
Publication Date |
@(guide.DocumentTitle ?? guide.FullName) |
@pubDate |
No matching records found |
Diagrams (Wiring, Installation)
@if (diagrams.Any())
{
}
@foreach (var diagram in diagrams)
{
var pubDate = diagram.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(diagram.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
}
@if (!diagrams.Any())
{
}
Document Name |
Publication Date |
@(diagram.DocumentTitle ?? diagram.FullName) |
@pubDate |
No matching records found |
Bulletins (Service, Parts, Product Recalls)
@if (bulletins.Any())
{
}
@foreach (var bulls in bulletins)
{
var appliesTo = bulls.Metadata.ContainsKey("AppliesTo") ? "Applies To: " + bulls.Metadata["AppliesTo"].ToString() : "";
var pubDate = bulls.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(bulls.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
}
@if (!bulletins.Any())
{
}
Document Name |
Publication Date |
@(bulls.DocumentTitle ?? bulls.FullName) @appliesTo |
@pubDate |
No matching records found |
------------- END -----------
The generated source code is:
------------- START -----------
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace CompiledRazorTemplates.Dynamic {
using System;
using System.Collections.Generic;
using System.Linq;
using Emanager.Razor;
using Emanager.Utilities;
using Emanager.Data.Abstractions.Ecommerce.Model;
using Emanager.Data.Abstractions;
public class RazorEngine_05a0c0e109474c69b1c2bb948ca1e935 : Emanager.Razor.RazorBase<><>>> {
public RazorEngine_05a0c0e109474c69b1c2bb948ca1e935(Emanager.Data.IDependencyResolver resolver, System.Func loadWebsite) :
base(resolver, loadWebsite) {
}
public override void Execute() {
WriteLiteral(" ");
var category = @Model.Model;
var bomProductAssets = category.Assets;
var allAssets = bomProductAssets.Where(d => !d.Metadata.ContainsKey("isPublic") || bool.Parse(d.Metadata["isPublic"].ToString()))
.OrderByDescending(o => o.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(o.Metadata["PublicationDate"].ToString()) : DateTime.MinValue);
var specs = allAssets.Where(d => d.Metadata.ContainsKey("manualType") && d.Metadata["manualType"].ToString().Equals("advanced specs",StringComparison.OrdinalIgnoreCase));
var manuals = allAssets.Where(d => d.Metadata.ContainsKey("manualType")
&& (d.Metadata["manualType"].ToString().Equals("Operator's Manual",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Parts Manual",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Superseded Parts Listing",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Technical Manual",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Installation Manuals",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Callout Drawing",StringComparison.OrdinalIgnoreCase)));
var guides = allAssets.Where(d => d.Metadata.ContainsKey("manualType") && d.Metadata["manualType"].ToString().Equals("Troubleshooting Guide",StringComparison.OrdinalIgnoreCase));
var diagrams = allAssets.Where(d => d.Metadata.ContainsKey("manualType")
&& (d.Metadata["manualType"].ToString().Equals("Wiring Diagram",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Installation Diagrams",StringComparison.OrdinalIgnoreCase)
));
var bulletins = allAssets.Where(d => d.Metadata.ContainsKey("manualType")
&& (d.Metadata["manualType"].ToString().Equals("Service Bulletin",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Parts Bulletin",StringComparison.OrdinalIgnoreCase)
|| d.Metadata["manualType"].ToString().Equals("Product Recall",StringComparison.OrdinalIgnoreCase)));
var breadcrumbPages = "5399ada1daf73a26740bf60b|Low-CO EFI Gasoline Generators|low-coefigasolinegenerators.htm,5399ada1daf73a26740bf60c|Carbureted Gasoline Generators|carburetedgasolinegenerators.htm,5399ada1daf73a26740bf60d|Electronic Diesel Generators|electronicdieselgenerators.htm,5399ada1daf73a26740bf60e|Diesel Generators|traditionaldieselgenerators.htm,5399ada1daf73a26740bf60f|Westerbeke Engines|westerbekeengines.htm,5399ada1daf73a26740bf610|Climate Control|climatecontrol.htm,5399ada1daf73a26740bf611|Gasoline Engines|westerbekeengines.htm,5399ada1daf73a26740bf612|Industrial Generators|industrialgenerators.htm,5399ada1daf73a26740bf613|Sound Guards|soundguards.htm,5399ada1daf73a26740bf614|Universal Engines|universalengines.htm,5399ada1daf73a26740bf615|Westerbeke Engines|westerbekeengines.htm".Split(',').ToList();
var parentPage = category.Path[1].ToString().ToLowerInvariant();
var breadCrumb = breadcrumbPages.FirstOrDefault(x => x.Contains(parentPage));
var landingPage = breadCrumb.Split('|')[2];
var landingPageName = breadCrumb.Split('|')[1];
WriteLiteral(" \r\n\r\n\r\n
\r\n
\r\n - (ResolveUrl("~/index.htm")
, 3669), false)
);
WriteLiteral(">Home
\r\n - (ResolveUrl("~/")
, 3722), false)
, Tuple.Create(Tuple.Create("", 3724), Tuple.Create(landingPage
, 3724), false)
);
WriteLiteral(">");
Write(landingPageName);
WriteLiteral("
\r\n - (category.Name.SanitizeFileName()
, 3800), false)
, Tuple.Create(Tuple.Create("", 3833), Tuple.Create("/", 3833), true)
, Tuple.Create(Tuple.Create("", 3834), Tuple.Create(category.Id
, 3834), false)
);
WriteLiteral(">");
Write(category.Name);
WriteLiteral("
\r\n - Technical Documents
Technical Documents
Important Note: Technical information is provided on our website for your reference and convenience. Westerbeke recommends that your engine, generator or climate control system is serviced and/or installed only by an authorized Westerbeke distributor or dealer. (ResolveUrl("~/distributorlocator.htm")
, 4261), false)
);
WriteLiteral(">Click here to locate the Master Distributor or Dealer for your area.
\r\n Advanced Specifications
\r\n \r\n");
if (specs.Any())
{
WriteLiteral(" \r\n\r\n \r\n Document Name\r\n | Publication Date\r\n | \r\n \r\n");
}
WriteLiteral(" \r\n");
foreach (var spec in specs)
{
var pubDate = spec.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(spec.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
WriteLiteral(" \r\n (ResolveUrl("~/")
, 5166), false)
, Tuple.Create(Tuple.Create("", 5168), Tuple.Create(spec.FullName
, 5168), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">");
Write(spec.DocumentTitle ?? spec.FullName);
WriteLiteral("\r\n ");
Write(pubDate);
WriteLiteral("\r\n | | \r\n");
}
WriteLiteral(" ");
if (!specs.Any())
{
WriteLiteral(" \r\n No matching records found\r\n | \r\n");
}
WriteLiteral(" \r\n \r\n\r\n Manuals (Operators, Parts, Technical, Installation)\r\n
\r\n");
if (manuals.Any())
{
WriteLiteral(" \r\n\r\n \r\n Document Name\r\n | Publication Date\r\n | \r\n \r\n");
}
WriteLiteral(" \r\n");
foreach (var man in manuals)
{
var pubDate = man.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(man.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
WriteLiteral(" \r\n (ResolveUrl("~/")
, 6386), false)
, Tuple.Create(Tuple.Create("", 6388), Tuple.Create(man.FullName
, 6388), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">");
Write(man.DocumentTitle ?? man.FullName);
WriteLiteral("\r\n ");
Write(pubDate);
WriteLiteral("\r\n | | \r\n");
}
WriteLiteral(" ");
if (!manuals.Any())
{
WriteLiteral(" \r\n No matching records found\r\n | \r\n");
}
WriteLiteral(" \r\n \r\n\r\n Guides (Troubleshooting)\r\n
\r\n");
if (guides.Any())
{
WriteLiteral(" \r\n\r\n \r\n Document Name\r\n | Publication Date\r\n | \r\n \r\n");
}
WriteLiteral(" \r\n");
foreach (var guide in guides)
{
var pubDate = guide.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(guide.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
WriteLiteral(" \r\n (ResolveUrl("~/")
, 7588), false)
, Tuple.Create(Tuple.Create("", 7590), Tuple.Create(guide.FullName
, 7590), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">");
Write(guide.DocumentTitle ?? guide.FullName);
WriteLiteral("\r\n ");
Write(pubDate);
WriteLiteral("\r\n | | \r\n");
}
WriteLiteral(" ");
if (!guides.Any())
{
WriteLiteral(" \r\n No matching records found\r\n | \r\n");
}
WriteLiteral(" \r\n \r\n\r\n Diagrams (Wiring, Installation)\r\n
\r\n");
if (diagrams.Any())
{
WriteLiteral(" \r\n\r\n \r\n Document Name\r\n | Publication Date\r\n | \r\n \r\n");
}
WriteLiteral(" \r\n");
foreach (var diagram in diagrams)
{
var pubDate = diagram.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(diagram.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
WriteLiteral(" \r\n (ResolveUrl("~/")
, 8814), false)
, Tuple.Create(Tuple.Create("", 8816), Tuple.Create(diagram.FullName
, 8816), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">");
Write(diagram.DocumentTitle ?? diagram.FullName);
WriteLiteral("\r\n ");
Write(pubDate);
WriteLiteral("\r\n | | \r\n");
}
WriteLiteral(" ");
if (!diagrams.Any())
{
WriteLiteral(" \r\n No matching records found\r\n | \r\n");
}
WriteLiteral(" \r\n \r\n\r\n Bulletins (Service, Parts, Product Recalls)\r\n
\r\n");
if (bulletins.Any())
{
WriteLiteral(" \r\n\r\n \r\n Document Name\r\n | Publication Date\r\n | \r\n \r\n");
}
WriteLiteral(" \r\n");
foreach (var bulls in bulletins)
{
var appliesTo = bulls.Metadata.ContainsKey("AppliesTo") ? "Applies To: " + bulls.Metadata["AppliesTo"].ToString() : "";
var pubDate = bulls.Metadata.ContainsKey("PublicationDate") ? DateTime.Parse(bulls.Metadata["PublicationDate"].ToString()).ToShortDateString() : "N/A";
WriteLiteral(" \r\n (ResolveUrl("~/")
, 10181), false)
, Tuple.Create(Tuple.Create("", 10183), Tuple.Create(bulls.FullName
, 10183), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">");
Write(bulls.DocumentTitle ?? bulls.FullName);
WriteLiteral(" ");
Write(appliesTo);
WriteLiteral(" \r\n ");
Write(pubDate);
WriteLiteral("\r\n | | \r\n");
}
WriteLiteral(" ");
if (!bulletins.Any())
{
WriteLiteral(" \r\n No matching records found\r\n | \r\n");
}
WriteLiteral(" \r\n \r\n \r\n
\r\n