zoukankan      html  css  js  c++  java
  • Programming EF with Code First (二) Configuration for relationships

    public class Destination
    {
    public int DestinationId { getset; }
    public string Name { getset; }
    public string Country { getset; }
    public string Description { getset; }
    public byte[] Photo { getset; }
    public List<Lodging> Lodgings { getset; }
    }
    public class Lodging
    {
    public int LodgingId { getset; }
    public string Name { getset; }
    public string Owner { getset; }
    public bool IsResort { getset; }
    public decimal MilesFromNearestAirport { getset; }
    public Destination Destination { getset; }
    }

    Specifying an optional one-to-many relationship

    modelBuilder.Entity<Destination>()
    .HasMany(d => d.Lodgings)
    .WithOptional(l => l.Destination);
    技术改变世界
  • 相关阅读:
    字典树
    Floyd算法
    迪杰斯特拉算法---单源点最短路径
    二叉树的遍历
    图的遍历
    二叉排序树
    拓扑排序
    开发中框架的发展
    IOC
    JS操作JSON总结
  • 原文地址:https://www.cnblogs.com/davidgu/p/2675198.html
Copyright © 2011-2022 走看看