1 / 13

続 Entity Framework 入門

SQLWorld #8. 続 Entity Framework 入門. サヴロウ. 自己紹介. サヴロウ      ・医療系のシステム開発してます  ・フライパンズのベース & アレンジ  ・ライブ予定    2 / 11 ( 土 ) 六甲アイランド    2 / 19 ( 日 ) 高槻アクトアモーレ. http://www.okumar.com. EntiryFramework って 何?.

ken
Download Presentation

続 Entity Framework 入門

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQLWorld #8 続 Entity Framework 入門 サヴロウ

  2. 自己紹介 サヴロウ      ・医療系のシステム開発してます  ・フライパンズのベース&アレンジ  ・ライブ予定    2/11(土)六甲アイランド    2/19(日)高槻アクトアモーレ http://www.okumar.com

  3. EntiryFrameworkって何? ・ADO.NET Entity Framework(以降、Entity Framework)とは、.NET Framework 3.5からADO.NETに追加された、新しい概念に基づくデータ・アクセス技術である。 ・最新バージョンは4.3 Beta 2012/1リリース

  4. データモデルの説明おさらい  アプリケーションで扱うデータをモデル化したもので、データベースのテーブルなどには依存しないモデル 概念モデル 論理モデル 概念モデルをデータの表現形式にあわせて変換したもの *一般的にはリレーショナルデータベースが使われる   ので、テーブル、主キー外部キーなどに変換 物理モデル リレーショナルデータベースにあわせてインデックスの設計や、パーティション分割などを行う

  5. 概念モデルと論理モデルの違いの例 例)多対多のパターン  一人の学生は複数の講義を受講し、一つの講義には複数の学生が受講する。 概念モデル

  6. 概念モデル 論理モデル

  7. EntityFramework概要 アクセスの仕方 ・ LINQ to Entities  →LINQ to SQLではない ・通常のエンティティモデルとして  →For Eachで回せる EntityFrameworkに基づく データアクセス 概念モデル CSDL マッピング MSL 論理モデル SSDL

  8. EDMウィザードでできたモデル? ・参照が多すぎ →Entity Frameworkとの結合度が高すぎて、  階層化されたアプリでは非常に使いにくい ・自動でコードが作られるので・・・ もっとプレーンなクラスにならないか・・・  →POCO(Plane Old CLR Object)を使用してエンティティクラスを作成したい

  9. コードファースト 順序 (1)POCOでエンティティモデルを作成 (2)エンティティをデータベースに接続するコンテキストクラスを作成 →System.Data.Entity.DbContext

  10. DEMO ・POCOでエンティティモデルを作成 ・DbContextを作成 ・DBが勝手にできる!? ・アノテーション

  11. 現時点の問題点他 ・データベースのマイグレーション(カラム追加とか)には現時点で対応していない  →EF4.3 Betaでできる ・Enum未対応  →EF5.0で対応の予定?

  12. リンク他 ・ADO.NET Team Blog http://blogs.msdn.com/b/adonet/ ・Entity Framework 4.1入門(@IT) http://www.atmarkit.co.jp/fdotnet/ef4basic/index/index.html#ef41 ・ADO.NET Entity Framework 4.1 における Code First http://msdn.microsoft.com/ja-jp/magazine/hh126815.aspx

  13. ご清聴ありがとうございました

More Related