It turns out that your Razor views are not to be writen in exactly the same way as when running within an ASP.NET web context. I suppose I should have guessed this from the way I was used to declaring the model for the WebFormsViewEngine.
Solution
Instead of using the@model
declaration at the the top I should have been using @inherits
. An example:Regular Razor view for web:
@model Models.ContactDetailsViewModel <!DOCTYPE html> <html> <body> <div> <p>Hello @Model.FullName,</p> <p>We will call you at @Model.CallTime on @Model.PhoneNumber</p> <p>Thanks</p> </div> </body> </html>
Razor view for use as a template:
@inherits RazorEngine.Templating.TemplateBase<Models.ContactDetailsViewModel> <!DOCTYPE html> <html> <body> <div> <p>Hello @Model.FullName,</p> <p>We will call you at @Model.CallTime on @Model.PhoneNumber</p> <p>Thanks</p> </div> </body> </html>
Hope this helps and well done for using such an awesome feature of the RazorEngine!
Hi
ReplyDeleteThanks for the info, this solved the compile problem, however I no longer get intellisense in VS2010. In the cshtml file the intellisense tells me that a reference is missing to the RazorEngine assembly.
Did you get this problem?
I added the RazorEngine using NuGet so it got all the references for me and it all works well so I can't say I recognise your issue. I'm using VS2010 SP1 if that helps.
ReplyDeleteThe @model keyword is specific to ASP.NET MVC3's RazorViewEngine. The base parser itself doesn't support it, but it does support adding custom keywords. Visual Studio using @model out of the box to support its Intellisense feature (it can use either @inherits or the terse @model).
ReplyDeleteYou can manually add support for this in RazorEngine v2 but you'd need to recompile it. I'm hoping to introduce a generic keyword extension mechanism in v3 which should easily enable these scenarios.
Thanks for the info Matthew. But much more importantly thanks for making the Razor Engine!
ReplyDeleteFYI, @model has been implemented in v3, which I am hoping to push onto GitHub soon :-)
ReplyDeleteSaved my day. Thank you! Thank you very much!!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI get a TemplateCompilationException but it is on my model type, not on the model keyword. I get the same exception when I change it to "@inherits RazorEngine.Templating.TemplateBase<MyType>". Any pointers there?
ReplyDeleteI resolved the issue I was having. I was not fully-qualifying MyType. After fully qualifying it, e.g. "@model ModelNamespace.MyType", it now works. This blog was helpful: http://mehdi.me/generating-html-emails-with-razorengine-basics-generating-your-first-email/
ReplyDeleteGreat ARticle
ReplyDeleteGoogle
ReplyDeleteI have just found this website while searching over the internet, you have posted valuable information which i like reading. Hyundai Xcent Double Din PlayerTata Nexon Double Din PlayerHyundai VernaHypersonic OEM Double Din PlayerJ3l USB Double Din PlayerDouble Din DVD Player
ReplyDeletecar accessoriesHyundai Creta OEM Double Din PlayerHyundai i20 OEM Double Din PlayerHyundai Grand i10 OEM Double Din Player
Motifz Designer Lawn. 1, 2 & 3 Piece Unstitched Premium Embroidered Lawn 2019, Premium embroidered Lawn, Premium lawn, Premium lawn 2019, Motifz, Premium lawn in Pakistan. Shipping worldwide. Stitching option available.
ReplyDeleteNice Post.
ReplyDeletehttps://forum.parallels.com/threads/unable-to-connect-outlook-to-office-365-since-reboot.346498/
https://community.constantcontact.com/t5/Need-help-with-something-else/Tab/td-p/314570/page/2
https://www.prestashop.com/forums/topic/956372-white-page-in-prestashop/
https://community.teamviewer.com/t5/TeamViewer-General/Will-not-connect-to-partner-computer-Team-Viewer-14-1-18533/td-p/56122
https://communities.vmware.com/message/2843114
Are you in need of Custom Term Paper Writing Services for your various Custom Term Paper Assignment Services? Do not fret; Legitimate Custom Term Paper Writing Services is here to provide the necessary assistance you require to attain your academic aspirations.
ReplyDeleteIf you want to protect your system online or locally from any unforeseen events Norton.com/Setup is is a must have software in your PC or Mac.
ReplyDeleteInstall your office.com/Setup by downloading now. Microsoft Office applications are a complete package if multiple integrations like Microsoft Office, Microsoft Power Point, Microsoft Excel etc. All of these programs have their own features and speciality and are used in a lot of industries, small organizations and big organizations.
McAfee.com/Activate Since the world is developing each day with new computerized advances, digital dangers, malware, information, and harming diseases have additionally turned out to be increasingly more progressed with every day. These digital contamination's harm a gadget or documents in different ways. McAfee.com/Activate follows the concept of refine your system, you don’t need to worry about data loss or system failure because of the malfunctions. McAfee.com/Activate works finely on every system including android and ios and supports device like, computer, laptops, mobile phones and tablets. McAfee.com/Activate McAfee.com/Activate
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one. hyip templates
ReplyDeleteThe writer is enthusiastic about purchasing wooden furniture on the web and his exploration about best wooden furniture has brought about the arrangement of this article. hyip templates
ReplyDeleteI am very thankfull to you for sharing this fantastic article , I appereciate your work .
ReplyDeletemcafee.com/activate , mcafee.com/activate
This antivirus scans all the folders on the system so that any malware cannot damage the users' essential documents.
ReplyDeletemcafee.com/activate , mcafee.com/activate
It read your article every thing is clear , Thanks for sharing.
ReplyDeleteoffice.com/setup , mcafee.com/activate
Activate Trendmicro - Follow steps to download, install, and activate Trend Micro product. Type the product key by clickingtrendmicro.com/activation.
ReplyDeleteI feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it. hyip template
ReplyDeleteMagic ISO Maker Crack containing exact binary copies of the original CDs. Usually, you have to burn an ISO file on a CD to extract its contents, but now you can simply open an ISO file in MagicISO. Magic ISO Maker 2016 Serial Key can make bootable CD/DVD picture document. With Magic ISO, you can prepare the boot data for CD/DVD picture document, and straightforwardly include/ evacuate/ separate boot picture for the CD/DVD picture record. Download Magic ISO Maker Build 281 Full Serial Key 2016 from here.MagicISO Maker Serial Key is an awesome application that can be used for creating and editing disk images. The interface if he application is very catchy and its explorer based layout makes it easy to navigate. In addition to being able to edit the contents of the disc images without decompressing, it can make a disc image from an existing CD/DVD-ROM. Also, it can make bootable image files (file extension. bif). MagicISO Maker Latest Version can mount disc images with the addition of MagicISO Virtual CD/DVD Manager. with Magic ISO Maker you can burn the image files onto CD-R, CD-RW, DVD-R, DVD-RW. You can also compress and decompress image files as well. Magic ISO Maker can handle upto 10GB of DVD images. All in all Magic ISO Maker Keygen is a very useful and can be used for creating the image files as well as for extracting the content from the image files.
ReplyDeleteSuch a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. website builder easy free
ReplyDeleteThrough this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing. website builder godaddy
ReplyDeleteWe are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work gadgetdeep pocket
ReplyDeleteI think I have never seen such blogs ever before that has complete things with all details which I want. So kindly update this ever for us. iphone 11 cases
ReplyDeleteI have checked this link this is really important for the people to get benefit from. free english course online video
ReplyDeleteWe are tied directly into the sate’s renewal database which allows us to process your request almost instantly. buy essays HD lace
ReplyDeleteYou have written such a interesting blog.it is worth of reading.keep updating and sharing with us
ReplyDeleteDigit me
Zen Watson
This post is very simple to read and appreciate without leaving any details out. Great work! Short Term Rental Missouri
ReplyDeleteMmm.. good to be here in your article or post, whatever, I think I should also work hard for my own website like I see some good and updated working in your site. Registered dietitian
ReplyDeleteTruly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found this one pretty fascinating and it should go into my collection. Very good work! LED mini mirror
ReplyDeleteCool stuff you have and you keep overhaul every one of us rechargeable LED
ReplyDeleteThis is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. thomasjefferson
ReplyDeleteI quite like reading an article that can make people think. Also, thanks for allowing for me to comment! Revitalizing
ReplyDeleteYour blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging, demeter cologne spray
ReplyDelete
ReplyDeleteشركة تلميع سيارات بالرياض
شركة تلميع أسطح سيارات بالرياض
شركة غسيل سيارات بالرياض
شركة تنظيف بالرياض
The contents you mentioned in post are too good and very useful. I will keep it in mind, thanks for sharing the information keep updating further If you are looking for the best antivirus software and support so you should try one of them which may help you a lot. Click below:
ReplyDeleteNorton.com/setup
I’m usually to blogging and i really admire your content. The article has really peaks my interest. I am going to bookmark your web site and keep checking for brand spanking new information. logo designers
ReplyDeleteYou’ll find some fascinating points in time in this post but I do not know if I see all of them center to heart. There’s some validity but I will take hold opinion until I appear into it further. Fantastic post , thanks and we want much more! Added to FeedBurner too new york web designs
ReplyDeleteI am very glad after reading your blog , Thanks for shring .
ReplyDeletewindows-10
ipad
iphone
firefox
sensorexplorer2.0
facebook
Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.
ReplyDeletehyip templates
Islam, one among largest religions in the world also the one that is misunderstood all time. There are several sources including political, economic & media, framed Islam as misleading religion. And the truth about muslims are always hidden from the light.
ReplyDeleteTruth About Islam
Truth About Muslims
Islamic Sharia Law
Women In Islam
Why Wear Hijab
Quran And Science
Muslims Are Not Terrorists
Polygamy In Islam
the holy book of islam
We are working as public beneficiaries as we share analyzed and evaluated solutions with people who are looking for a good solution on McAfee login. If you are also looking for such assistance. You can either go to our website or contact us via call.
ReplyDeleteVisit here: https://mcafeepro.com/
Plenty Of Fish is a leading social network for dating. It offers the opportunity to meet people of dating age from different countries. This platform not only in a location close to you, but specifically somebody who specializes POF in marriages. Explore fast solutions in
ReplyDeletePOF Login
Plenty Of Fish Login
Plenty Of Fish Login Page
Pof Login Inbox
Thanks for taking the time to share with us such a great article. I found such a significant number of fascinating stuff with regards to your blog particularly its discussion. Keep doing awesome.
ReplyDeletehttps://www.sephoragiftcardbalance.com/
Sephora Gift Card Balance Sephora Gift Card Balance Check Sephora Card Balance Sephora Check Balance Jcpenney Sephora Gift Card Balance Check Sephora Gift Card Balance Sephora Check Gift Card Balance Sephora Gift Card Check Balance Check Gift Card Balance Sephora
Fantazi Fantazi Shop Fantazi İç Giyim Fantezi İç Giyim Erotik Shop Fantazi Gecelik
ReplyDeleteThis article really contains a lot more information about This Topic. We have read all the information some points are also good and some usually are awesome.
ReplyDeleteonevanilla gift card,
onevanilla check balance,
onevanilla balance check,
onevanilla balance,
onevanilla card balance,
onevanilla prepaid visa card balance,
www onevanilla balance,
check my vanilla visa balance,
onevanilla prepaid visa card,
check onevanilla balance,
check vanilla balance,
check one vanilla balance,
onevanilla card balance,
onevanilla gift balance,
onevanilla gift card balance,
onevanilla master card balance,
onevanilla balance ceck,
onevanilla balance check online,
onevanilla online balance check,
onevanilla mastercard balance,
onevanilla card balance check,
onevanilla prepaid balance check,
check onevanilla gift card balance,
one vanilla visa gift card balance,
one vanilla mastercard gift card balance,
onevanilla prepaid gift card balance,
onevanilla prepaid visa gift card balance,
check my onevanilla gift card balance,
check balance on onevanilla visa gift card,
check onevanilla visa gift card balance,
This article really contains a lot more information about This Topic. We have read all the information some points are also good and some usually are awesome.
ReplyDeleteamerican express gift card balance,
amexgiftcard com balance,
check american express gift card balance,
amex gift card balance check,
american express prepaid card balance,
amex gift balance,
american express check balance,
american express prepaid gift card balance,
amex check balance,
express gift card balance,
american express gift card activation,
american express card balance,
Buy online wholesale printed candle boxes and packaging at easy prices and shipping worldwide, with 24/7 customer support. Get a free custom quote now!!
ReplyDeleteBuy online wholesale printed custom lipstick boxes and packaging at easy prices and shipping worldwide, with 24/7 customer support. Get a free custom quote now!!
ReplyDeleteThinking pessimistic sides of the things makes us hopeful so that I would like to suggest to all the readers that they must keep an eye on the positive sides of the things for getting success in their life. Assignment Writing Service
ReplyDeleteBlackbird packaging provide you with any size, shape design, wholesale cookie boxes sooner than any other packaging competitor in the market
ReplyDeletePackaging town is a one-stop solution for the short-run cbd tincure boxes needs, and supplies. At affordable prices. Request a free quote now.
ReplyDeleteBlackbird packaging provide you with any size, shape design, custom cbd bath bomb boxes sooner than any other packaging competitor in the market
ReplyDeleteBlackbird packaging provide you with any size, shape design, custom cbd bath bomb boxes sooner than any other packaging competitor in the market
ReplyDeleteSuch a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Doge
ReplyDeleteGreat Article
ReplyDeleteCloud Computing Projects
Networking Projects
Final Year
Projects for CSE
JavaScript Training in Chennai
JavaScript
Training in Chennai
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals,
Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer.
Angular Training
The information is very special, I will have to follow you, the information you bring is very real, reflecting correctly and objectively, it is very useful for society to grow together.
ReplyDeleteOnevanilla Check Balance Check Vanilla Visa Gift Card Balance
Thanks for taking the time to share with us such a great article. I found such a significant number of fascinating stuff with regards to your blog particularly its discussion. Keep doing awesome.
ReplyDeleteSephora Gift Card Balance Sephora Gift Card Balance Check
Hello, This is a Nitu roy very interesting blog. this content is written very
ReplyDeletewell This is an amazing post, keep blogging.
Guwahati Escorts
Guwahati escort service
You can book call girl in Guwahati or escort Service in Guwahati for incall facility
ReplyDeleteor outcall Facility as and when required.To book Guwahati call girls you
can visit the following links
Guwahati Call Girl
Call Girl in Guwahati
Diya Roy is a premier escort Service in Guwahati that provides call girl services
ReplyDeleteor Call Girls in Guwahati hotels at cheap and affordable fixed rates.
Call Girl in Guwahati
Guwahati Call Girl
Blackbird packaging company can provide you with any size, shape design, and custom bottle neckers wholesale sooner than any other packaging competitor in the market
ReplyDeletePackaging town is a one stop solution for the short-run custom candle boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeleteExplore the profiles of guwahati escorts, guwahati call girls, call girls in guwahati and
ReplyDeleteescorts in guwahati for female companionship in top rated hotels.
Get affordable escort services in guwahati hotels now.
Guwahati call girls
Call girls in Guwahati
Blackbird packaging company can provide you with any size, shape design, and bath bomb boxes sooner than any other packaging competitor in the market
ReplyDeleteBlackbird packaging provide you with any size, shape design, cbd bath bomb boxes sooner than any other packaging competitor in the market
ReplyDeleteHIU REPAIR and maintenance in London.
ReplyDeleteSpecialists engineers in heat interface units danfoss, Evinox modusat, giocomini, caleffi
JS Removals offer professional home removal services & rubbish clearances for the East Midlands. With hundreds of 5* Reviews book with confidence. moving company
ReplyDeleteBlackbird packaging provide you with any size, shape design, bath bomb packaging sooner than any other packaging competitor in the market
ReplyDeletePackaging town is a one stop solution for the short-run custom display boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeleteBlackbird packaging provide you with any size, shape design, bath bomb packaging sooner than any other packaging competitor in the market
ReplyDeletePackaging town is a one stop solution for the short-run rigid boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeleteBlackbird packaging provide you with any size, shape design, wholesale cookie boxes sooner than any other packaging competitor in the market
ReplyDeletePackaging town is a one stop solution for the short-run custom candle boxes needs and supplies. At affordable prices. Request a free quote now.
ReplyDeletebuy tshirts for men online from dshred at easy prices delivered at your doorstep. Get free shipping
ReplyDeleteThanks for sharing a particularly decent data through this blog. I trust it will help everybody. I like your work, kindly continue to share. We are the main online instructive gateway that gives assignment composing administrations particularly to understudies.
ReplyDeleteassignment help
Open the software utility that manages your wireless connections on the computer or wireless device that you want to connect to your router. Using Netgear WNDR4720 Manual, you can setup your router. This utility scans for all wireless networks in your area. Find and select your wireless network name (SSID). The SSID is located on the product label.
ReplyDeleteBuy shorts for men from ndure at best prices delivered at your doorstep. Get free shipping
ReplyDeleteBuy women cotton tees online from ndure at easy prices delivered at your doorstep. Get free shipping
ReplyDeleteBuy mens gym trousers online from Dshred at best prices delivered at your doorstep. Get free shipping
ReplyDeleteBuy grocery online from Al-Fatah at best prices delivered at your doorstep. Get free shipping
ReplyDeleteThe given article covers all the important and necessary details for the topic so thanks for sharing this information! it was very informative and helpful!
ReplyDeletemyassignmenthelp
Buy electronics online from Al-Fatah at best prices delivered at your doorstep. Get free shipping
ReplyDeleteBuy men clothing online in Pakistan from Al-Fatah at best prices delivered at your doorstep. Get free shipping.
ReplyDeleteThanks for Sharing this fantastic blog. I really enjoyed it and get to learn many important things. Visit Us : https://fertilitycentrenepal.com/
ReplyDeleteFrom Ndure buy comfortable best workout shirts for women at affordable price. Fast Shipping.
ReplyDeleteI like this post. Are you in need of custom thesis writing help at affordable rates? Let us help you, we offer top-quality writing hel online.
ReplyDeleteEither go to Foxnews.com/connect and enter the displayed Activation Code or use your smartphone camera to read the QR code shown. When creating a profile, after entering the activation code, the Create Your Account screen will be displayed. Launch the FOX App on your device. Sign in with an existing FOX account by entering your email and password. Once you're signed in, select the Cast icon from the upper or lower right side of the screen. Select your Chromecast from the list of devices to launch the FOX App on your TV. Fox News Channel on Roku comes with most of the News content from the cable version of it. It also has many episodes of many popular shows from the channel if you are a subscriber to the pay TV service.The free content includes the Latest News videos, Top Stories, Primetime Highlights.Can I watch FOX on my phone? Yes. Simply download FOX NOW on your iOS or Android device. Then enter paid TV subscription credentials to activate the app and begin streaming your favorite shows, live sports, and news.
ReplyDeleteCheck your device's compatibility with Disneyplus.com/begin . Go to your device's settings and check for any updates through your firmware settings. If you are using the Disney Plus app, try to delete and re-install it from the app store of your device. Google Play store for Android devices and App store for iOS devices.Disney Plus allows for up to four separate devices to stream movies and TV shows simultaneously. There are no household or internet network restrictions, which means four devices can stream while under the same roof or spread across the country. There can be a few reasons why Disney+ is not showing up on your Smart TV.
ReplyDelete