Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

c# - RazorEngine doesnt parse when view contains model

I am trying to parse my .cshtml view using RazorEngine in separate library project without ASP or MVC like following:

string result = Engine.Razor.RunCompile(pathTofile, "template2", null, model);

My template looks like that:

@using TemplateEngine.Helpers;
@model TemplateEngine.ViewModels.BaseComponentViewModel

<table>
  @Model.Elements.GetElementValue("value")
</table>

But unfortunately i get an error that it cannot recognize GetElementValue(which is a separate method thats why I import Helpers)

Do you have any suggestions what i might doing wrong?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...