I am using the 'Asp.Net Core 2.0' and installed nuget package 'Microsoft.EntityFrameworkCore' version '3.0.0-preview5.19227.1', when I want to use a IQuarable functions, I get the above Error.
public partial class Wfuser
{
public Wfuser()
{
UserRole = new HashSet<UserRole>();
}
public int IdUser { get; set; }
public string FullName { get; set; }
public string UserName { get; set; }
public virtual Userauth Userauth { get; set; }
public virtual ICollection<UserRole> UserRole { get; set; }
}
public class NormalUser : IUser
{
public string UserName { get; set; }
public string Password { get; set; }
public NormalUser(string UserName, string Password)
{
this.UserName = UserName;
this.Password = Password;
}
public Wfuser CurrentWFUSER { get; set; }
public string ErrorMessage { get; set; }
ITTMSContext db;
public bool IsAuthenticated { get; set; }
public UserProfile Profile { get; set; }
public bool Authenticate()
{
db = new ITTMSContext();
CurrentWFUSER = db.Wfuser.FirstOrDefault(u => u.UserName == UserName);
int idUser = CurrentWFUSER.IdUser;
}
}
The full error message was:
'Unable to determine the relationship represented by navigation property 'JToken.Parent' of type 'JContainer'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
答案 0 :(得分:2)
我终于独自发现了这一点。
如错误消息所述,我应该在表字段中不在的属性之前添加一个[NotMapped]
属性。