When I created new table “post” and give foreign key relation to another “category” table after that run the custom tool by right click on edmx file. While running the application I got the following error. It was resolved by including post table foreign key relation to the category class.
The relationship model was not loaded because the type model is not available.The following information may be useful in resolving the previous error:
The required property does not exist on the type model class
Example:
namespace example.Areas.Admin.Models
{
using System;
using System.Collections.Generic;
public partial class Category
{
public Category()
{
this.Posts = new HashSet<Post>();
}
public int CategoryId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Nullable<int> CreatedUserId { get; set; }
public Nullable<System.DateTime> PostedOn { get; set; }
public Nullable<System.DateTime> ModifiedOn { get; set; }
public Nullable<int> ModifiedUserId { get; set; }
public virtual ICollection<Post> Posts { get; set; }
}
}
if we given any foregin key relation to the table and also entity is not updated properly. Manually we need to set the model class property or function.
Post your comments / questions
Recent Article
- How to get domain name information from a Domain using Python
- ModulenotFoundError: no module named 'debug_toolbar' -SOLUTION
- How to create superuser in django project hosted in cPanel without terminal
- CSS & images not loading in django admin | cpanel without terminal
- Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects
- How to sell domain name on Godaddy (2023)
- TemplateSyntaxError at / Could not parse the remainder: ' + 1' from 'forloop.counter0 + 1'
- urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0
Related Article