3 entity framework 6 ninja edition whats new m3 slides

12
Julie Lerman thedatafarm.com @julielerman Performance and Stability Improvements EF6 Changes for Faster Apps with Fewer Exceptions

Upload: art-sauer

Post on 11-Nov-2015

227 views

Category:

Documents


1 download

DESCRIPTION

Introduction to EF 6

TRANSCRIPT

  • Julie Lermanthedatafarm.com

    @julielerman

    Performance and Stability Improvements

    EF6 Changes for Faster Apps with Fewer Exceptions

  • In This Module

    Faster LINQ Enumerable.Contains Method Compilation Faster Mapping View Generation Using nGen to Reduce JIT Compilation Cost of EF6 Creating Snapshot-Enabled SQL Server Databases Share Open Database Connections Connection Resiliency

  • Faster Compilation of Enumerable.Containscontext.Ninjas.Where(n=>listOfIds.Contains(n.Id))

    EF5 & earlier Expression Tree built with OR statements Building tree suffered with large enumerables Performance issue was in compilation, not DB

    EF6 Expression tree built with IN Quick compilation even with large enumerables SQL & DB performance unaffected

  • Faster Mapping View Generation

    Was for big, complex models

    Design TimeReduces Startup Cost

    Run Time

    Contributed byAlireza Haghshenas

  • Faster Mapping View Generation

    Noticable for big, complex models

    Contributed by Alireza Haghshenas

  • Ngen for Faster Startup

    No JIT at runtime(~ 1 second) Machine specific

    Compile entityframework.dll

    natively

    ngenInstallentityframework.dll

    MSDN doc on Ngenparameters, usage considerations & caveats

    juliel.me/ngen_doc

  • Snapshot Enabled by Default

    LiveDatabase

    W

    R

    I

    T

    E

    t

    o

    D

    B

    Read-OnlySnapshot

    R

    E

    A

    D

    f

    r

    o

    m

    D

    B

    Default transaction isolation level is changed to READ_COMMITTED_SNAPSHOTfor databases created using Code First,

    potentially allowing for more scalability and fewer deadlocks

    SET TRANSACTION ISOLATION LEVEL{ READ UNCOMMITTED| READ COMMITTED| REPEATABLE READ| SNAPSHOT| SERIALIZABLE}

    [ ; ]

  • Open Connections Can Be Re-Used

    EntityConnectioncan be instantiated

    with an open DbConnection

  • Connection Resiliency

    TransientConnection

    Failure

    RetryN times

    SpecifyMax Retry Period

    DbExecutionStrategye.g., SqlAzureExecutionStrategy

  • Quick Review

  • Resources

    EF Project: EntityFramework.codeplex.com My blog: thedatafarm.com/blog EF Team Blog: blogs.msdn.com/adonet Entity Framework 6 Articles in MSDN Magazine:

    EF6 Ninja Edition, Dec 2013 (julieL.me/MSDN_EF6Ninja)Code First Goodies in Entity Framework 6 Jan 2014 (julieL.me/MSDN_EF6CF)

    Entity Framework Courses on Pluralsight: julieL.me/PS-Videos LINQ Contains explanation by Diego Vega: julieL.me/EFContains Transient Connection Errors Described: julieL.me/TransientCtx Ngen Documentation: julieL.me/ngen_doc

  • Julie Lermanthedatafarm.com

    @julielerman