Comments (1)
Hi, thanks for kind words.
Basically you need to make CustomRazorEngineTemplate : RazorEngineTemplateBase
where you can define new keywords and their logic and you can name them the way it fits you most
public class MyTemplateBase : RazorEngineTemplateBase
{
public Func<string, object, string> IncludeCallback { get; set; }
public string Include(string key, object model = null)
{
return this.IncludeCallback(key, model);
}
}
and when you run this template you will have callback for rendering component where you can render your component
string result = template.Run(instance =>
{
instance.Model = model;
instance.IncludeCallback = (key, includeModel) => {
// render your component, say, other razor engine template
}
});
<div>
@Include("Logo", Model)
</div>
see wiki:
https://github.com/adoconnection/RazorEngineCore/wiki/@Include-and-@Layout
from razorenginecore.
Related Issues (20)
- Include and Layout Wiki is outdated with current RazorEngine.Compile() method HOT 2
- System.TypeLoadException. HOT 5
- RazorEngineCompilationException for Strongly typed model. HOT 1
- Does it support to use in docker? HOT 1
- Dotnet 7/C#11 Support HOT 2
- How to use partial templates like a files? HOT 1
- Support for init-only setters HOT 1
- Compile templates at build-time HOT 2
- options to generate debugging information? HOT 4
- dotnet7 single file HOT 4
- run linq lambdas inside template seems to have problems HOT 2
- No thing
- A break mode occurs in Maui .net android app. It works fine in Win UI
- when empty value prop on html tag,razor doc parse error HOT 5
- Debug issue
- Get rid of System.Web dependency HOT 2
- RazorEngineCore NuGet package does not contain license information HOT 1
- RazorEngineCore.ObjectExtenders.IsAnonymous(this object obj) not recognizing dynamic or anonymous types HOT 3
- HtmlSafeTemplate broken after upgrading from 2022.8.1 to 2023.11.2 HOT 1
- NET8 Component rendering to HTML for libraries outside Blazor! HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from razorenginecore.