views:

18

answers:

0

I have the following entity object:

public class ForumPost
    {
        public virtual int ForumPostId { get; set; }
        public virtual int LoginId { get; set; }
        public virtual string Body { get; set; }
...

Then I have a page that has a list of ForumPost(s) and and edit option, all on one page. I've created a CommentsViewModel that extends "ForumPost" class like so:

public class CommentsViewModel : ForumPost
{
    public IPagedList<ForumPost> ForumPostList { get; set; }
}

This way on my view I can have a list of ForumPost(s) and a form that would edit the post.

The problem is that when I try to Save/Update I get the following error:

"Mapping and Metadata info could not be found for EntityType: ...CommentsViewModel"

I already tried doing this:

this.ForumPostRepository.Insert((ForumPost)model);

OR

ForumPost row = (ForumPost)model;

with no luck. for some reason downcasting doesn't work and the model or row are still of type CommentsViewModel instead of ForumPost

Thanks