MVC4 Beta: Important Change to DisplayMode


As many of you know the beta of MVC4 came out. Of course I downloaded and installed it.

I noticed my existing code such as…

DisplayModes.Modes.Insert(0, new DefaultDisplayMode("iPhone")
{
ContextCondition = (ctx => ctx.Request.UserAgent.IndexOf(
"iPhone", StringComparison.OrdinalIgnoreCase) >= 0)
});

gave an error “DisplayModes” does not exist in the current context. Wait a sec, I updated my references and everything, what gives.

well they threw something new in there.

the correct code is now..

DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iPhone")
{
ContextCondition = (ctx => ctx.Request.UserAgent.IndexOf(
"iPhone", StringComparison.OrdinalIgnoreCase) >= 0)
});

Notice the

 DisplayModeProvider.Instance 

it replaced the older DisplayModes.

I am sure there is more. I will post them as I find them.

Advertisements

3 thoughts on “MVC4 Beta: Important Change to DisplayMode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s