Entity framework code first end to end
Download
1 / 13

Entity Framework Code First End to End - PowerPoint PPT Presentation


  • 203 Views
  • Uploaded on

Entity Framework Code First End to End. Sergey Barskiy Architect, Tyler Technologies. Level: Introductory to Intermediate. Introduction to EF. Entity Framework in Microsoft’s ORM Tool Has been out since 2008 Code First has been out since 2011. Why Entity Framework Code First. ORM

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Entity Framework Code First End to End' - izzy


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Entity framework code first end to end

Entity Framework Code First End to End

Sergey Barskiy

Architect, Tyler Technologies

Level: Introductory to Intermediate


Introduction to ef
Introduction to EF

  • Entity Framework in Microsoft’s ORM Tool

    • Has been out since 2008

    • Code First has been out since 2011


Why entity framework code first
Why Entity Framework Code First

  • ORM

  • Code / type safety

  • Rapid application development and prototyping

  • Supported and developed by Microsoft

  • Continuous commitment from Microsoft

  • Open sourced

  • Testable

  • Flexible / Conventions and configurations


Approaches
Approaches

  • DAL?

  • Business Layer?

  • UI?


Separation of concerns
Separation of Concerns

  • EF is DAL technology

  • Isolation from other layers

  • Patterns

    • Repository

    • Data Mapper

    • Table Data Gateway

    • Row Data Gateway

    • Data Mapper


Dal strategy
DAL Strategy

  • Keep Data (Table) Objects clean

  • Separate data access from DTOs

  • Create Access Interface

  • Expose Data Access in a service layer with business objects

  • Using Mappers to cut down on code


Developing model
Developing Model

  • Configuration Options

    • Configuration classes

    • Attributes?

  • Handling Relationships

    • Relationship Types

    • Using foreign key columns

  • Using Complex types

  • Legacy databases / explicit mappings


Creating data access layer
Creating Data Access Layer

  • Repository Pattern

    • Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.

    • Interface based repository

    • CQRS

    • Write vs. Read Repository

    • Taking dependency on IQueryable?


Working with views and stored procedures
Working with Views and Stored Procedures

  • EF is not all-or-nothing answers

  • Writing classes for materialization

  • Avoiding SQL injection


Handling schema changes
Handling Schema Changes

  • Code First Migrations

    • Create database

    • Maintain schema

    • Command line migrations

  • Explicit vs. Implicit Migrations

  • Initializers (for rapid prototyping)

  • Migrating initializer


Performance
Performance

  • Caching Context

    • Web environments

  • CRUD Efficiencies

    • Update

    • Delete

    • Select

  • Lazy Loading

    • Beware of multiple queries


Demo solution
Demo Solution

  • ASP.NET MVC

  • Layer Separation via Projects


Contact info
Contact Info

  • [email protected]

  • www.DotNetSpeak.com


ad