Asp.net 5 - VNext ViewData property in ViewResult is Null -


i'm using asp.net 5 small application , i'm having little trouble returning viewresult orchestrator.

where in previous versions of mvc we've done this:

 return new viewresult         {             viewname = "index",             viewdata = {model = _formviewmodelbuilder.buildmodel()}         }; 

in mvc 6 throws null reference exception. setting model property of viewdata invalid value of viewdata null? believe has dependency injection can't find concrete explanation anywhere why behavior happening.

the simplest way can work like:

return new viewresult             {                 viewname = "index",                 viewdata = new viewdatadictionary<formviewmodel>(viewdata, model)             }; 

this uses microsoft.aspnet.mvc.controller.viewdata property. can pass property through orchestrator i'm not sure if plain wrong , i'm missing trick here?

any appreciated.

thanks

i managed answer on @ github. viewdata object can't created without imodelmetadataprovider or existing viewdata object.

i solved issue passing viewdata object default property on controller through orchestrator , creating new object based on that.

full details can found here: https://github.com/aspnet/mvc/issues/2814


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -