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);
    技术改变世界
  • 相关阅读:
    [转]mysql视图学习总结
    [转]mysql索引详解
    mysql索引的操作
    [转]mysql的约束
    mysql表的操作
    【转】mysql的数据类型
    java泛型
    java 8新特性
    Dubbo有意思的特性介绍
    dubbo + zookeeper
  • 原文地址:https://www.cnblogs.com/davidgu/p/2675198.html
Copyright © 2011-2022 走看看