views:

152

answers:

1

I am using EFExtensions with a typed view in mvc and am getting

The model item passed into the dictionary is of type 'Microsoft.Data.Extensions.Materializer`1+d__0[MvcCms.Web.Models.User]' but this dictionary requires a model item of type 'MvcCms.Web.Models.ViewData.SiteAdminModel'.

'MvcCms.Web.Models.ViewData.SiteAdminModel' contains a definition of User, here is the code in SiteAdminModel

public class SiteAdminModel
{
    public StateProvince SelectedState { get; set; }

    public IEnumerable<StateProvince> States { get; set; }

    public IEnumerable<Organization> Organizations { get; set; }

    public IEnumerable<User> Users { get; set; }

}

What would be the best way to fix this. Possibly using a codebehind to cast the Materialized version or doing that in the controller?

A: 

The problem was occuring because I was passing the model through in the renderpartial and it didn't need to be passed there because the control had access without it.