Using .NET Core and Entity Framework Core Linux/Windows with Oracle Database
Alex Keh Senior Principal Product Manager Server Technologies October 23, 2018
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda 1
ODP.NET Core – Production Release
2
ODP.NET Core – Configuration API
3
ODP.NET Core – Future Directions
4
ODP.NET Entity Framework Core – Beta Release
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
2
ODP.NET Core Production Release
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
3
.NET Core •New CLR released from Microsoft •Open source
•Multi-platform •Subset of .NET Framework APIs and new APIs too •Code-based configuration
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
4
ODP.NET Core Very Similar to Managed ODP.NET
•Same namespaces, APIs, and DLL name as managed ODP.NET •Supports Easy Connect, sqlnet.ora, and tnsnames.ora –Place *.ora files in • Directory set in OracleConfiguration.TnsAdmin property • Directory of the running ODP.NET Core assembly • Current working directory
•No .NET configuration file nor environment variable support
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
5
ODP.NET Core RTM
•Available on nuget.org –https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/
•Oracle version 18.3 •NuGet version 2.18.3 •Adds Red Hat Linux support since beta
•Connectivity to Oracle Database 11.2 and higher
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
6
ODP.NET Core System Requirements
•.NET version support –.NET Core 2.1 and later –.NET Framework 4.6.1 and later –.NET Standard 2.0
•Windows and Linux support –Same Windows versions as ODP.NET 18c: 7, 8.1, 10, 2012, 2012 R2, and 2016 –Oracle Linux 7.x –Red Hat Enterprise Linux 7.x Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
7
D E M O N S T R A T I O N
ODP.NET Core Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
ODP.NET Core on Oracle Linux Configuration Steps
• Install .NET Core SDK by running the following from Oracle Linux host: sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packagesmicrosoft-prod.rpm sudo yum update sudo yum install dotnet-sdk-2.1
• Instructions page – https://bit.ly/2ObVCiH
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
9
D E M O N S T R A T I O N
Deploying ODP.NET Core to Linux on Oracle Cloud Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Demo Resources You Can Try It Yourself
• Oracle Cloud Infrastructure – Oracle Linux running on compute
• Oracle Database Cloud Service – ODP.NET Core also works with Oracle Autonomous Database
• Free cloud credits: https://cloud.oracle.com/tryit
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
11
Installation ODAC 18c
•ODP.NET Core available with –NuGet, MSI, and OUI bundles only –Not in xcopy bundle
•ODP.NET Core packaged as NUPKG only –Install using NuGet package manager or command line (i.e. nuget.exe, dotnet.exe)
–Once installed, can be xcopy deployed
•Installation on Linux is NuGet only
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
13
Oracle Database 18c Express Edition (XE) Free DB for developers
• Linux version available now • Windows version very soon • Free for dev, production, and redistribution • (Almost) all features as Enterprise Edition + options • No patches, but… –New XE version every year • Follows the DB on-premises release • i.e. 19c, 20c, 21c, etc.
• CPU, memory, and hard disk limits Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
14
ODP.NET Core Configuration API
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
15
ODP.NET Core Classes New Configuration APIs
•OracleConfiguration class –Used to programmatically set ODP.NET configuration settings
•OracleDataSourceCollection class –Configure network service names (i.e. TNS) to connect to Oracle DBs
•OracleOnsServerCollection Class –Logical servers and corresponding node list where Oracle Notification Service (ONS) daemons talk to remote clients
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
16
ODP.NET Core Configuration API Code Sample
// Add connect descriptors and net service names entries. OracleConfiguration.OracleDataSources.Add("orclpdb", "(DESC... OracleConfiguration.OracleDataSources.Add("orcl", "(DESCRIP... // Set ODP.NET command properties OracleConfiguration.StatementCacheSize = 25; OracleConfiguration.SelfTuning = false; OracleConfiguration.BindByName = true; OracleConfiguration.CommandTimeout = 60; OracleConfiguration.FetchSize = 1024 * 1024; // Set network properties OracleConfiguration.SendBufferSize = 8192; OracleConfiguration.ReceiveBufferSize = 8192; OracleConfiguration.DisableOOB = true; Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
17
D E M O N S T R A T I O N
ODP.NET Core Configuration API Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Migrating from Managed ODP.NET to ODP.NET Core Changes to Make
•Assembly – use ODP.NET Core Oracle.ManagedDataAccess.dll •.NET configuration – migrate to code-based configuration
•Tnsnames.ora and sqlnet.ora configuration – no changes •Namespace – no changes •APIs – Minimal to no changes
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
19
ODP.NET Core Future Directions
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
20
ODP.NET Core Future Directions
•Windows only features –LDAP –Event Log –Performance Counters
•.NET Core 3.0
•Entity Framework Core
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
22
ODP.NET Entity Framework Core Beta Release
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
23
Oracle Entity Framework Core Beta
•Release will be on nuget.org –Namespace: Oracle.EntityFrameworkCore –For beta, remember to check “Include pre-release” box
•Supports Entity Framework Core 2.1 and higher •Oracle EF Core supports the same OSes as ODP.NET Core
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
24
Oracle Entity Framework Core Setup
•Runtime dependencies –Oracle.EntityFrameworkCore
•Design time dependency –Microsoft.EntityFrameworkCore.Design
•Connection and provider configuration using extension method optionsBuilder.UseOracle(@“
");
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
25
D E M O N S T R A T I O N
Oracle Entity Framework Core Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Additional Oracle .NET Resources OTN otn.oracle.com/dotnet GitHub github.com/oracle/dotnet-db-samples/ Twitter twitter.com/OracleDOTNET
YouTube youtube.com/OracleDOTNETTeam Email [email protected] Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Upcoming .NET Sessions – Wednesday Online schedule: https://bit.ly/2yXG8oQ • Move Your .NET Core Applications to Linux in the Cloud with Docker – Wednesday – 1:30 PM – 2:15 PM Moscone West – 2008
• Running Oracle Database and Applications in Docker Containers on Windows – Wednesday – 3:45 PM – 4:30 PM Moscone West – 3010
• Accelerate Application Performance: Tips for Faster Oracle Database .NET Programs • Wednesday – 4:45 PM – 5:30 PM Moscone West – 3010
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Upcoming .NET Sessions – Thursday Online schedule: https://bit.ly/2yXG8oQ • Eliminate Application Downtime with Oracle Database and .NET – Thursday – 9:00 AM – 9:45 AM Moscone West – 3010
• Hands on Lab: Building .NET Applications with Oracle – Thursday – 12:00 PM – 1:00 PM Marriott Marquis (Yerba Buena Level) – Salon 3 / 4
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
.NET Demo at the Exchange – Booth DBA-WU2
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Questions and Answers
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
31