• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2542
  • Last Modified:

Getting error in MVC 'system.data.entity.core.objectscontext' to type 'system.data.objects.objectcontext'

Hi ,

I am new to MVC pattern . I am using Entity Framework 6.0 and getting error as

unable to retrive metadata. unable to cast object of type 'system.data.entity.core.objectscontext' to type 'system.data.objects.objectcontext'

While creating controller.
There is no error in compiling the application . Where do I need to look for error?

Please let me know if you need more info on this

public partial class Person
    {
        public Person()
        {
            this.Application_User = new HashSet<Application_User>();
            this.Student_Care = new HashSet<Student_Care>();
        }
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int Person_ID { get; set; }
        public string Person_Type { get; set; }
        public string Status { get; set; }
        public string Initial_Name { get; set; }
        public string First_Name { get; set; }
        public string Last_Name { get; set; }
        public string Middle_Name { get; set; }

Open in new window

0
Vikash p
Asked:
Vikash p
  • 2
1 Solution
 
apeterCommented:
Please show us the code there this casting problem(system.data.entity.core.objectscont) is coming ...looks like the problem with the object context
0
 
Vikash pAuthor Commented:
Upgread to MVC 6.0 and problem solved
0
 
Vikash pAuthor Commented:
Just want to close Q and ask new question. Other answer not complete
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now