相关疑难解决方法(0)

实体框架中的导航属性是什么?

我在EF图中看到了很多这些导航属性,但不确定它们的真正含义.就像我在很多表中看到的那样,我有aspnet_Users属性.

这些是为了什么?他们帮助加入吗?或者是什么?

Error 2
Error 3007: Problem in Mapping Fragments starting at lines 1201, 1423: 
Non-Primary-Key column(s) [Field2] are being mapped in both fragments 
to different conceptual side properties - data inconsistency is possible 
because the corresponding conceptual side properties can be independently 
modified.
Run Code Online (Sandbox Code Playgroud)

.net entity-framework

27
推荐指数
1
解决办法
3万
查看次数

属性“ x”不是实体类型“ y”的导航属性

我将EF Core和ASP Core 2.0一起使用。使用最新的身份框架。我在“全部”页面上收到此异常。

InvalidOperationException:属性“ User”不是实体类型“ Gallery”的导航属性。“ include(string)”方法只能与“。”一起使用。导航属性名称的分隔列表。

ApplicationUser看起来像:

public class ApplicationUser : IdentityUser<Guid>
{
    public ICollection<Gallery> Galleries { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

实体图库如下所示:

public class Gallery
{
    public int Id { get; set; }
    public Guid UserId { get; set; }
    public string Title { get; set; }
    public int? ArticleId { get; set; }
    public string Photos { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }

    public Article Article …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core asp.net-core

9
推荐指数
1
解决办法
8346
查看次数