Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Razor custom view model breaks with Layout #12

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

alanta
Copy link

@alanta alanta commented May 24, 2020

Setting a custom model for a Razor view while also using a layout and viewstart file causes an error similar to this:

Exception while processing document /ViewStartAndLayout/Test.cshtml in module unknown: The model item passed into the ViewDataDictionary is of type 'System.Int32[]', but this ViewDataDictionary instance requires a model item of type 'Wyam.Common.Documents.IDocument'.

There are two new tests in this PR. There was no test yet for setting the view model from a delegate and the second test covers the error.

The fix I did doesn't seem to break any tests which seems, which makes me wonder why that line was there in the first place.

A bit of background: I'm working on a Wyam module that pulls in content from Kontent headless CMS. The client for that CMS supports strong typed content models which is something I'm also hoping to support with this module for Wyam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant