asp.net mvc 4 - MVC4 - Controller Scaffolding, Custom Data context class issue: Unable to retrieve metadata -


When I try to make a controller from the scaffold, I get the following error:

Unable to retrieve, Metadata specified schema for 'turkeyup.models.admin.catcousview model' is not valid Errors: mapping of CLR type EDM is unclear because many CLR types match EDM type 'coursework'.

Here is the code for model:

  Using the system ComponentModel.DataAnnotations; Using System.Web.Mvc; Namesphere TorkUp.Models.Admin {Public Classroom CreateCourseViewModel {[HiddenInput (DisplayValue = false)] Public Ent ID {get; Set; } [Required] public string title {get; Set; }}}   

Custom Data Reference Class:

  using System.Data.Entity; Using System.Linq; Using TorkUp.ClassLibrary; Using TorkUp.ClassLibrary.Admin; Using TorkUp.ClassLibrary.User; Nameshot TorkUp Infrastructure {University of Public Sector DB: DBCTTENT, IUniversityDataSource {Public University DB (): Base ("Default Concession") // Admin Data Public DBAet & Lt; Curriculum & gt; Course {Get; Set; } Public DbSet & lt; Class & gt; Classes {receive; Set; } Public DbSet & lt; Coursework & gt; Courseworks {get; Set; } Public DbSet & lt; Students & gt; Student {Received; Set; } // User Data Public DbSet & lt; Assignment & gt; Assignment {Receive; Set; } Public DbSet & lt; Work & gt; Work {get; Set; } // Admin Data IQueryable & lt; Curriculum & gt; IUniversityDataSource.Courses {Get return courses; }} IQueryable & lt; Class & gt; IUniversityDataSource.Classes {Get {Return Classes; }} IQueryable & lt; Coursework & gt; IUniversityDataSource.Courseworks {{Return Courseworks; }} IQueryable & lt; Students & gt; IUniversityDataSource.Students {Back {return student; }} // User Data IQueryable & lt; Assignment & gt; IUniversityDataSource.Assignments {Back {Assignments; }} IQueryable & lt; Work & gt; IUniversityDataSource.Tasks {get {return actions; }} // Empty database in iUniversityDataSource.Save () {SaveChanges (); }}}   

and the class for course:

  using System.Collections.Generic; Namesphere TorkUp.ClassLibrary.Admin {Public Entry ID {Public Entry ID (Receive; Set;} Public String Title {get; set;} Public String Description {get; set;} Public Icon & lt; Class & gt; Classes { Receive; set;} Public Icons & lt; Coursework & gt; Courseworks {get} Set;}}}}    

If you have this error, then it will be for you DbContext :

  // admin data public dbet & lt; Course & Course; Course {Receive; Set;} Public DbSet & lt; Class & gt; Classes {Get; Set;} Public DbSet & lt; Coursework & gt; Courseworks {get; Set;} // Courses are used to make the classroom classes, but when you do Scaffolds, you use CreateCourseViewModel.Public DbSet & lt; Student & gt; Students {Receive; Set;}   < P> If you want to use the  CreateCourseViewModel  This line of change has to be changed. But I think that as you want to wrap the other sections to display in view of the purpose of  ViewModel  in the  CreateCourseViewModel .   

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -