小编abz*_*rak的帖子

实体框架:为什么忽略WillCascadeOnDelete()方法?

这是我的情况:

public abstract class Article
{
    [key]
    public Guid Guid { get; set;}

    public string Name { get; set;}
    .
    .
    .
}

public class Download : Article
{
    ...
}

public abstract class Category : Article
{
    ...
}

public class DownloadCategory : Category 
{
    ....
}
Run Code Online (Sandbox Code Playgroud)

然后我应该在下载之间有一个多对多的关系,DownloadCategory就像这样:

public class DownloadInCategory
{
    [Key, Column(Order = 1), Required]
    [ForeignKey("Download")]
    Public Guid DownloadGuid { get; set; }

    Public Download Download { get; set; }

    [Key, Column(Order = 2), Required] …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework cascade one-to-many

13
推荐指数
1
解决办法
3516
查看次数

标签 统计

c# ×1

cascade ×1

entity-framework ×1

one-to-many ×1