smolyakoff / essential-templating Goto Github PK
View Code? Open in Web Editor NEWA set of templating libraries.
License: MIT License
A set of templating libraries.
License: MIT License
The Essential.Templating.Common nuget package is outdated and conflicting with the latest Essential.Templating.Razor.Email
Exception Details: System.MissingMethodException: Method not found: '!!0 Essential.Templating.Razor.TemplateContext.AddOrGetExisting(System.String, System.Func`1<!!0>)'.
The old FileSystemResourceProvider doesn't throw an exception if the template is not found and returns null instead
Is the usage of Resources.Link supported from layout templates?
We're finding that if a resource is linked to the layout, the correct cid:XXX tag is inserted, but the linked resource itself isn't added to the e-mail. Doing the same from the main template works perfectly.
Thanks.
I have tried to use this in my MVC project but the "Essential.Templating.Common.dll" is missing. I've installed it through nuget. I have download your test poject as well but this dll is missing
thanks
zak
I get the following error when trying to use either a VB or C# template from within my VB.NET project.
Essential.Templating.Razor.Runtime.TypeMismatchException: Expected base template type: RazorEngine.Templating.ITemplate1[VB$AnonymousType_0
2[System.String,System.String]]. Actual base template type: Essential.Templating.Razor.Email.EmailTemplate
Running on .NET 4.5.1 on Windows 8.1 x64.
All but one unit test fails in the Razor and Razor.Email projects.
All the failing tests fail like this:
Test method Essential.Templating.Razor.Email.Tests.EmailTemplateTest.RenderSimpleEmail threw exception:
Essential.Templating.Common.TemplateEngineException: Can't create instance of template [CompiledRazorTemplates.Dynamic.ebedacaeabcadb].
Base type: [Essential.Templating.Razor.Email.EmailTemplate]. ---> Essential.Templating.Razor.Runtime.ActivatorException: Can't create instance of template [CompiledRazorTemplates.Dynamic.ebedacaeabcadb].
Base type: [Essential.Templating.Razor.Email.EmailTemplate]. ---> System.ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
at System.DateTimeOffset..ctor(DateTime dateTime)
at System.DateTimeOffset.op_Implicit(DateTime dateTime)
at Essential.Templating.Razor.Runtime.ReflectionTemplateFactory.Create(Type templateType, TemplateContext templateContext) in ReflectionTemplateFactory.cs: line 30
at Essential.Templating.Razor.Runtime.TemplateActivator.Activate(Type templateType, TemplateContext context) in TemplateActivator.cs: line 26
--- End of inner exception stack trace ---
at Essential.Templating.Razor.Runtime.TemplateActivator.Activate(Type templateType, TemplateContext context) in TemplateActivator.cs: line 30
at Essential.Templating.Razor.RazorTemplateEngine.ActivateTemplate(Type templateType, TemplateContext context) in RazorTemplateEngine.cs: line 280
--- End of inner exception stack trace ---
at Essential.Templating.Razor.RazorTemplateEngine.ActivateTemplate(Type templateType, TemplateContext context) in RazorTemplateEngine.cs: line 284
at Essential.Templating.Razor.RazorTemplateEngine.ResolveTemplate(String path, CultureInfo culture) in RazorTemplateEngine.cs: line 157
at Essential.Templating.Razor.RazorTemplateEngine.Render(String path, IRenderer`2 renderer, Object viewBag, CultureInfo culture) in RazorTemplateEngine.cs: line 95
at Essential.Templating.Razor.Email.TemplateEngineExtensions.RenderEmail(ITemplateEngine templateEngine, String path, Object viewBag, CultureInfo culture) in TemplateEngineExtensions.cs: line 21
at Essential.Templating.Razor.Email.Tests.EmailTemplateTest.RenderSimpleEmail() in EmailTemplateTest.cs: line 30
After updating RazorEngine from 3.4.1 to 3.5.2, Essential Templating throws an exception when trying to render an e-mail using
The top of the stack trace is:
System.MissingMethodException: Method not found: 'System.String RazorEngine.Templating.ITemplate.Run(RazorEngine.Templating.ExecuteContext)'.
at Essential.Templating.Razor.Email.TemplateEngineExtensions.RenderEmail(ITemplateEngine templateEngine, String path, Object viewBag, CultureInfo culture)
We've reverted RazorEngine back to 3.4.1 and the issue no longer exists.
Hello,
I was trying to use the model in the layout but I saw that it's not possible. Could you please add in Essential.Templating.Razor.Template and overload for ResolveLayout like this:
protected ITemplate ResolveLayout(string name, object model, Dictionary<string, object> contextEnvironment)
{
if (string.IsNullOrEmpty(name))
return (ITemplate) null;
Template template = this._templateContext.Resolve(name, model, this.Culture, (IDictionary<string, object>) contextEnvironment);
if (template == null)
throw new InvalidOperationException("Layout template was not found.");
else
return (ITemplate) template;
}
And, in TemplateContext an overload for Resolve with model.
Do you see any this wrong with that?
Best regards,
Mihai M
Hi,
After nuget upgrade to - any ideas....
----> Essential.Templating.Common.TemplateEngineException : This kind of usage is no longer supported!
----> System.NotSupportedException : This kind of usage is no longer supported!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.