Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:53:47+00:00 2026-05-27T17:53:47+00:00

for example the A.razortemplate <html> <title>@Page.Title</title> <keywords>@Page.Title</keywords> <body> crumb:<a href=>@Page.Title</a>><a href=>@Post.Title</a> <h3>@Post.Title<h3> @Post.Body by-@User.PostAuthor

  • 0

for example the A.razortemplate

<html>
<title>@Page.Title</title>
<keywords>@Page.Title</keywords>
<body>
    crumb:<a href="">@Page.Title</a>><a href="">@Post.Title</a>
    <h3>@Post.Title<h3>
    @Post.Body
    by-@User.PostAuthor
</body>
</html>

the above code in the one template(A),it include three @Model object that @Page,@Post,@User.i read the RazorEngine code,find just can pass one @Model patameter to the template,the following code from RazorEngine project.

protected virtual ITemplate CreateTemplate<T>(Type templateType, T model)
{
    var instance = CreateTemplate(templateType);
    SetModel(instance, model);
    return instance;
}

i hated only just can pass one @Model,i need to some more flexible method,i can remove crumb statement from template at anytime,can add time of the post.

for the above problem,may be i can create a new class and create three propertys for @page,@post,@user,i think it not perfect solution.

by the way,i want to take the RazorEngine as the front-end template(like a string template etc.),the ASP.NET as back-end just do sql operation and pass data to front-end.someone can give some suggest?thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:53:48+00:00Added an answer on May 27, 2026 at 5:53 pm

    RazorEngine uses a singular Model property be default. This property can be any type you like, so why not create a composite model:

    public class TemplateModel
    {
        public PostModel Post { get; set; }
        public UserModel User { get; set; }
        public PageModel Page { get; set; }
    }
    

    That way you can pass a singular model, and access the properties as:

    @Model.User.PostAuthor
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example (tested in Chrome): <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN> <HTML><HEAD> <TITLE>testing cursor
Example Page: http://kian02.comlu.com/kian3.html I want the Navi in the example page to have mouseover
Example Outlook: its only one process but can have multiple windows (user can double
Example: copy in one tmux pane (via vim), then switch to another pane (running
Example CSS #wrap{margin:20px} Code prettify wraps the whole line in .com <span class=com>#wrap{margin:20px}</span> Somebody
Example: the user fills in everything but the product name. I need to search
Example class code: <?php class example { public function forExample() { return true; }
Example: SELECT s.title, t.description, u1.value * s.cache_value as Cache, u2.value * s.drive_value as Drive,
Example code: int hour = 0; bool saveData = true; if(hour > 0) doSomeMethod();
Example program: list links This example program demonstrates how to fetch a page from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.