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 8697249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:28:41+00:00 2026-06-13T01:28:41+00:00

I do know there are several similar questions out there that address this topic,

  • 0

I do know there are several similar questions out there that address this topic, but I am not happy with the answers.

What I’d like is to take full advantage of the Razor View engine that can use strongly typed views with layout pages and partial views. I’d like to declare the model at the top of my views and just pass in that model. So simple! No dynamic models that need to be constructed explicitly just before passing them into the view. EDIT: I’d like to do this outside of a Web application, inside a class library that can construct email bodies. That’s the real issue here is making use of the Razor View Engine that is not a web app.

The idea behind this is if I have a User object with 20 properties on it and my first version of the Welcome email only uses the Name, but later I want to edit the template to use their City, State or Email address, then I want to be able to update the Razor view without having to add code and recompile and redeploy.

I see RazorEngine and I love the idea and simplicity, but everything is a dynamic type. My issue here is that I’ll be pulling data as models from the database. By having to shove things into a dynamic type, I don’t get all my properties on the View.

I also see MvcMailer, which is also nice in theory but it suffers from the same issue which is that all data models passed into the view are dynamic and not strongly typed.

I’ve begun to build out my own version of this, which will require several web namespaces like System.Web.Mvc, System.Web.Razor and System.Web.WebPages – and I’m okay with that. The issue is the lack of HttpContext and ControllerContext and RouteData …. which I’m trying to mock/stub so the. I’m currently trying to investigate DisplayModes and figure out how to mock these outside a real Web context.

Is there a better way? If you’re going to suggest one of the two previously mentioned frameworks, please note my issues and let me know if there are workarounds.

EDIT 2: After playing a bit more with the RazorEngine, the strongly typed models is not necessarily as much of an issue as I thought. What I’m left wishing for now is the ability to use a Layout page and partial views as well. I can hack around this with string placeholders that get replaced, but probably not very efficient AND not very flexible.

  • 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-06-13T01:28:42+00:00Added an answer on June 13, 2026 at 1:28 am

    The answer is that it doesn’t seem to matter whether the object passed in is dynamic or not. I can pass my strongly typed object, and it will be accepted as is without needing to make it dynamic or rebuild a dynamic object.

    My prelim tests show that this should be fine and works well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are several questions similar, but I can't find one that answers
I know there are similar questions out there, but I'm having trouble with this
I know there are several similar questions out there such as this one. I
I know there are several threads asking similar questions - but I havent found
I know there are several questions about satellite Assembly's out there, but I still
I know there are already several similar questions here, but I need some recommendations
I know there are several similar questions, but I'm struggling to understand the error
All right, do not get angry now, I know there are several questions about
I know there is a lot on this topic but I can't get any
I've looked at several similar questions but I didn't see any that directly applied

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.