28
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

1 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Page 2: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

2 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Entity Framework, LINQ, and WCF Data

Services for Oracle Database

Alex Keh

Principal Product Manager, Oracle

Page 3: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

3 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Page 4: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

4 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Program Agenda

• Entity Framework and LINQ

– General Concepts and Functionality

– Oracle Support for Entity Framework and LINQ

• WCF Data Services and OData

Page 5: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

5 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

ADO.NET Entity Framework

• Object-relational mapper (ORM) for .NET

– Abstracts the logical (relational) database schema

– Presents schema in an application-specific conceptual schema

– Eliminates object-relational impedance mismatch

– NHibernate – another popular ORM for .NET

• Data source providers abstract DB interfaces when

programming against conceptual model

Page 6: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

6 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

ADO.NET Entity Framework

• Entity data model (EDM) – conceptual data model that

maps to the relational model

• Entities represent the individual object instances

– E.g. employees, sales orders

• EDM Wizard and Designer

– Generating and modifying DB and conceptual schema mapping

Page 7: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

7 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Querying and Modifying Entities

• Query entities via alternative language to SQL

• LINQ to Entities

– Language-Integrated Query (LINQ)

– Query language integrated into .NET

– E.g. “from e in ctx.EMPs select e”

Page 8: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

8 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Querying and Modifying Entities

• Entity SQL

– SQL variant for declarative queries and updates over entities and

their relationships

– Uses EntityClient classes to query

– E.g. “select value e from Entities.EMPs as e”

• DML

– Stored procedures

– SaveChanges method on ObjectContext

Page 9: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

9 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Entity Framework Architecture

Page 10: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

10 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Entity Data Model Wizard and Designer

– Generate a conceptual model from Oracle Database

– Update conceptual model, storage model, and mappings from

Oracle Database

– Generate Oracle SQL DDL script from the conceptual model

Page 11: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

11 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Query language interfaces

– LINQ to Entities

– Entity SQL

– DML capabilities (insert/update/delete)

• Entity Framework auto-generates DML statements for Oracle

Database

• Or use your own Oracle stored procedures for DML

Page 12: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

12 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

D E M O N S T R A T I O N

Entity Framework and LINQ

Page 13: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

13 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• All standard ADO.NET APIs supported using ODP.NET

– Use EntityClient or ObjectContext

• No ODP.NET-specific APIs available, except…

– Settings available in the Registry or .NET config files including

ODP.NET connection string attributes

– E.g. FetchSize, SelfTuning, DllPath, Max Pool Size, HA Events,

Load Balancing, etc.

Page 14: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

14 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Function imports

– Define .NET methods that map to stored procedures

– Add Function Import dialog integration

Page 15: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

15 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Return implicit result sets

– Use REF CURSORs from stored procedures

– Available to both EF and non-EF scenarios

• EF: one result set per stored procedure

• Non-EF: one or more result set per stored procedure

– Return types

• Complex – read-only

• Entity – read and updatable

– Define result set bind and metadata info in .NET config file

Page 16: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

16 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

D E M O N S T R A T I O N

Function Import and Implicit Result Set

Page 17: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

17 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Return stored procedure scalar values

– Bind directly to stored procedure

– Only bind by name supported, not bind by position

– No .NET config changes necessary

// C#

ObjectParameter oparam = new ObjectParameter(“oparam", typeof(decimal));

Page 18: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

18 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Triggers and sequences

– Set StoreGeneratedPattern=“Identity” manually in SSDL

• Model/Schema generation

– Database-First

– Model-First

– Code-First – TBD

Page 19: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

19 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

D E M O N S T R A T I O N

Model-First

Page 20: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

20 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Oracle Support for LINQ and Entity Framework

• Requires .NET Framework 4 and Visual Studio 2010

• Time frame

– Beta: now available

– Production: Around end of 2011

• Availability will be announced via Twitter and Oracle

.NET newlsetter

– Twitter: @OracleDOTNET

– Newsletter: http://otn.oracle.com/dotnet

Page 21: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

21 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Program Agenda

• Entity Framework and LINQ

• WCF Data Services and OData

Page 22: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

22 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

WCF Data Services and OData

• WCF Data Services

– Platform for exposing data via web services and REST

– Accessed over HTTP with a URI to return data

– Represented as EDM objects

• Open Data Protocol (OData)

– Protocol for sharing data

– Allows a multitude of data consumers to interoperate with a

multitude of data producers

Page 23: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

23 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

D E M O N S T R A T I O N

WCF Data Services and OData

Page 24: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

24 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

More Oracle .NET Resources

• OTN .NET Developer Center

– http://otn.oracle.com/dotnet

• For more questions

[email protected]

Page 25: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

25 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Q&A

Page 26: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

26 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

26 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

The preceding is intended to outline our general product direction.

It is intended for information purposes only, and may not be

incorporated into any contract. It is not a commitment to deliver

any material, code, or functionality, and should not be relied upon

in making purchasing decisions. The development, release, and

timing of any features or functionality described for Oracle’s

products remains at the sole discretion of Oracle.

Page 27: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

27 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

Page 28: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · Oracle Support for LINQ and Entity Framework •Query language interfaces –LINQ to Entities –Entity SQL –DML capabilities

28 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.