zoukankan      html  css  js  c++  java
  • Entity Framwork 中的find方法 Kevin

    public ActionResult Index()
    {
    var albums = storeDB.Albums.Include("Genre").Include("Artist");
    return View(albums.ToList());
    }
    这里写成
    public ActionResult Index()
    {
    var albums = storeDB.Albums;
    return View(albums.ToList());
    }
    运行也一样,显示结果也一样, 也会包含genre和artist
    不知道两者有什么具体的区别?

     

    storeDB.Albums.Include("Genre").Include("Artist");
    表示查询的是 Albums,还要额外将其引用的 Genre 和 Artist 都查询到。

    storeDB.Albums;
    表示仅仅查询 Albums,对于 Genre 和 Artist 都使用延迟加载。

  • 相关阅读:
    Swift
    Swift
    书籍
    Swift
    Swift
    iOS系统架构
    Reveal真机(越狱)查看任意APP
    Swift
    Swift
    Swift
  • 原文地址:https://www.cnblogs.com/kfx2007/p/2536339.html
Copyright © 2011-2022 走看看