|
1 | 1 | Managed ODP.NET and ODP.NET Core Code Samples |
2 | 2 | ============================================= |
3 | 3 | You must have managed ODP.NET or ODP.NET Core installed. To run the samples, follow these directions: |
4 | | -1) Modify the Data Source attribute in the connection strings to connect to an Oracle database via Easy Connect, TNS connect descriptor, or TNS alias. |
5 | | -2) Most of these samples use the SCOTT or Human Resources (HR) schema. |
6 | | -The SCOTT schema create scripts are located here: https://github.com/oracle/dotnet-db-samples/tree/master/schemas |
| 4 | +1) Modify the Data Source attribute in the connection strings to connect to an Oracle database via Easy Connect (Plus), TNS connect descriptor, or TNS alias. |
| 5 | +2) Most of these samples use the SCOTT or Human Resources (HR) schema. <br> |
| 6 | +The SCOTT schema create scripts are located here: https://github.com/oracle/dotnet-db-samples/tree/master/schemas <br> |
7 | 7 | The HR schema create scripts are located here: https://github.com/oracle/db-sample-schemas |
8 | 8 | 3) Add Oracle.ManagedDataAccess.dll to the sample application. |
9 | | -4) Read <GitHub .NET samples directory>\doc\Readme.html, if any. |
| 9 | +4) Review the README file in the samples subdirectory, if any. |
10 | 10 |
|
11 | 11 | While these samples are designed for managed ODP.NET or ODP.NET Core, they generally can use unmanaged ODP.NET by incorporating Oracle.DataAccess.dll and |
12 | 12 | adding the unmanaged ODP.NET namespace reference (i.e. "using Oracle.DataAccess.Client;" and "using Oracle.DataAccess.Types;"). |
13 | 13 |
|
14 | 14 | Running ODP.NET Core Samples from Command Line |
15 | 15 | ============================================== |
16 | 16 | 1) Install .NET Core SDK from Microsoft's website: https://dotnet.microsoft.com/download |
17 | | -2) Open a terminal such as PowerShell, command prompt, or bash. Enter the following commands to create and setup your ODP.NET Core sample: |
18 | | - A) dotnet new console --output <Sample Name> |
19 | | - B) dotnet add package Oracle.ManagedDataAccess.Core --version <e.g. 3.21.3> |
20 | | -3) Replace the contents of Program.cs with the GitHub sample code of interest. |
21 | | -4) Insert your user id, password, and data source. The sample will have its own README or comments to indicate additional configuration that may be required. |
22 | | -5) Run using the following command: dotnet run --project <Sample Name> |
| 17 | +2) Open a terminal such as PowerShell, command prompt, or bash. Enter the following commands to create and setup your ODP.NET Core sample: <br> |
| 18 | + A) dotnet new console --output (Sample Name) <br> |
| 19 | + B) dotnet add package Oracle.ManagedDataAccess.Core --version (e.g. 3.21.120) |
| 20 | +4) Replace the contents of Program.cs with the GitHub sample code of interest. |
| 21 | +5) Insert your user id, password, and data source. The sample will have its own README or comments to indicate additional configuration that may be required. |
| 22 | +6) Run using the following command: dotnet run --project (Sample Name) |
23 | 23 |
|
24 | 24 |
|
25 | | -Below is a list of topics that the samples cover: |
| 25 | +Below is the feature list the samples cover. Each feature's sample has its own subdirectory. |
26 | 26 |
|
27 | 27 | Application Continuity |
28 | | -====================== |
| 28 | +---------------------- |
29 | 29 | Sample 1: Unmanaged ODP.NET Application Continuity code sample with setup and runtime demo instructions. |
30 | 30 |
|
31 | 31 | Parameter Array Binding |
32 | | -======================= |
| 32 | +---------------------- |
33 | 33 | Sample 1: Demonstrates parameter array binding. |
34 | 34 |
|
35 | 35 | ASP.NET Core |
36 | | -============ |
37 | | -ASP.NET Core 2.x: Demonstrates a simple ASP.NET Core 2.x web app to connect and retrieve data. |
38 | | -ASP.NET Core 3.x: Demonstrates a simple ASP.NET Core 3.x web app to connect and retrieve data. |
39 | | -ASP.NET Core 6: Demonstrates a simple ASP.NET Core 6 web app to connect and retrieve data. |
| 36 | +------------ |
| 37 | +ASP.NET Core 2.x: Demonstrates a simple ASP.NET Core 2.x web app to connect and retrieve data. <br> |
| 38 | +ASP.NET Core 3.x: Demonstrates a simple ASP.NET Core 3.x web app to connect and retrieve data. <br> |
| 39 | +ASP.NET Core 6: Demonstrates a simple ASP.NET Core 6 web app to connect and retrieve data. |
40 | 40 |
|
41 | 41 | PL/SQL Associative Array |
42 | | -======================== |
| 42 | +------------------------ |
43 | 43 | Sample 1: Demonstrates PL/SQL Associative Array binding. |
44 | 44 |
|
45 | 45 | Autonomous Database |
46 | | -=================== |
47 | | -ODP.NET Core Samples: Demonstrates how to connect ODP.NET Core to Oracle Autonomous Database via a console and an ASP.NET Core web app. |
48 | | -Managed ODP.NET Samples: Demonstrates how to connect managed ODP.NET to Oracle Autonomous Database via a console and an ASP.NET web app. |
| 46 | +------------------- |
| 47 | +ODP.NET Core Samples: Demonstrates how to connect ODP.NET Core to Oracle Autonomous Database via a console and an ASP.NET Core web app. <br> |
| 48 | +Managed ODP.NET Samples: Demonstrates how to connect managed ODP.NET to Oracle Autonomous Database via a console and an ASP.NET web app. <br> |
49 | 49 | Unmanaged ODP.NET Sample: Demonstrates how to connect unmanaged ODP.NET to Oracle Autonomous Database via a console app. |
50 | 50 |
|
51 | 51 | Azure Active Directory |
52 | | -====================== |
| 52 | +---------------------- |
53 | 53 | Demonstrates connecting to Oracle Autonomous Database using an Azure Active Directory token with ODP.NET Core, managed, and unmanaged. |
54 | 54 |
|
55 | 55 | Bulk Copy |
56 | | -========= |
| 56 | +--------- |
57 | 57 | Sample 1: Demonstrates how to use ODP.NET bulk copy. Sample works for both managed and core ODP.NET. |
58 | 58 |
|
59 | 59 | Client Factory |
60 | | -============== |
| 60 | +-------------- |
61 | 61 | Sample 1: Demonstrates how to use the OracleClientFactory class. |
62 | 62 |
|
63 | 63 | Command Builder |
64 | | -=============== |
65 | | -Sample 1: Demonstrates OracleCommandBuilder's SchemaSeparator property. |
66 | | -Sample 2: Demonstrates OracleCommandBuilders's QuoteIdentifier method. |
| 64 | +--------------- |
| 65 | +Sample 1: Demonstrates OracleCommandBuilder's SchemaSeparator property. <br> |
| 66 | +Sample 2: Demonstrates OracleCommandBuilders's QuoteIdentifier method. <br> |
67 | 67 | Sample 3: Demonstrates OracleCommandBuilders's UnquoteIdentifier method. |
68 | 68 |
|
69 | 69 | Configuration API |
70 | | -================= |
| 70 | +----------------- |
71 | 71 | Samples demonstrate how to use the OracleConfiguration, OracleDataSourceCollection, and OracleOnsServerCollection classes. |
72 | 72 |
|
73 | 73 | Connection |
74 | | -========== |
75 | | -Sample 1: Demonstrates OracleConnection's GetSchema() method. |
76 | | -Sample 2: Demonstrates all variations of OracleConnection's GetSchema(string) method overload. |
| 74 | +---------- |
| 75 | +Sample 1: Demonstrates OracleConnection's GetSchema() method. <br> |
| 76 | +Sample 2: Demonstrates all variations of OracleConnection's GetSchema(string) method overload. <br> |
77 | 77 | Sample 3: Demonstrates all variations of OracleConnection's GetSchema(string, string[]) method overload. |
78 | 78 |
|
79 | 79 | Connection String Builder |
80 | | -========================= |
| 80 | +------------------------- |
81 | 81 | Sample 1: Demonstrates how to use the OracleConnectionStringBuilder class. |
82 | 82 |
|
83 | 83 | DataReader |
84 | | -=========== |
85 | | -Unmanaged ODP.NET Sample: Demonstrates OracleDataReader's VisibleFieldCount and HiddenFieldCount properties. |
| 84 | +---------- |
| 85 | +Unmanaged ODP.NET Sample: Demonstrates OracleDataReader's VisibleFieldCount and HiddenFieldCount properties. <br> |
86 | 86 | ODP.NET Core Sample: Demonstrates how to connect and retrieve data using ODP.NET Core via a console app. |
87 | 87 |
|
88 | 88 | Data Source Enumerator |
89 | | -====================== |
| 89 | +---------------------- |
90 | 90 | Sample 1: Demonstrates the functionality of OracleDataSourceEnumerator class. |
91 | 91 |
|
92 | 92 | DataSet |
93 | | -======= |
94 | | -Sample 1: Demonstrates data manipulation language (DML) operations on a Dataset. |
95 | | -Sample 2: Demonstrates how to populate a DataSet using C#. |
96 | | -Sample 3: Demonstrates DML operations on LOB columns. |
97 | | -Sample 4: Demonstrates how to populate a DataSet from multiple output Ref Cursors from a stored procedure. |
| 93 | +------- |
| 94 | +Sample 1: Demonstrates data manipulation language (DML) operations on a Dataset. <br> |
| 95 | +Sample 2: Demonstrates how to populate a DataSet using C#. <br> |
| 96 | +Sample 3: Demonstrates DML operations on LOB columns. <br> |
| 97 | +Sample 4: Demonstrates how to populate a DataSet from multiple output Ref Cursors from a stored procedure. <br> |
98 | 98 | Sample 5: Demonstrates how to populate a DataSet using Visual Basic .NET (VB.NET). |
99 | 99 |
|
100 | 100 | Entity Framework Core |
101 | | -===================== |
102 | | -Autonomous Database Sample: Demonstrates Oracle EF Core connecting to Oracle Autonomous Database. |
103 | | -Dependency Injection Sample: Demonstrates using dependency injection and ASP.NET Core with Oracle EF Core. |
104 | | -Getting Started Sample: Demonstrates a basic Oracle EF Core scenario using migrations and scaffolding. |
105 | | -Keyless Entity Types Sample: Demonstrates Oracle EF Core keyless entity types with relational and materialized views. |
106 | | -Stored Procedure Result Set Samples: Demonstrates using PL/SQL that returns either an explicitly or implicitly bound REF Cursor. |
| 101 | +--------------------- |
| 102 | +Autonomous Database Sample: Demonstrates Oracle EF Core connecting to Oracle Autonomous Database. <br> |
| 103 | +Dependency Injection Sample: Demonstrates using dependency injection and ASP.NET Core with Oracle EF Core. <br> |
| 104 | +Getting Started Sample: Demonstrates a basic Oracle EF Core scenario using migrations and scaffolding. <br> |
| 105 | +Keyless Entity Types Sample: Demonstrates Oracle EF Core keyless entity types with relational and materialized views. <br> |
| 106 | +Stored Procedure Result Set Samples: Demonstrates using PL/SQL that returns either an explicitly or implicitly bound REF Cursor. |
107 | 107 |
|
108 | 108 | Event Handler |
109 | | -============= |
| 109 | +------------- |
110 | 110 | Sample 1: Demonstrates how to trap the OracleRowUpdatingEvent and OracleRowUpdatedEvent using VB.NET. |
111 | 111 |
|
112 | 112 | Oracle Identity and Access Management |
113 | | -===================================== |
| 113 | +------------------------------------- |
114 | 114 | Sample 1: Demonstrates how to use OCI .NET SDK to retrieve, authenticate, and refresh Oracle database tokens. |
115 | 115 |
|
116 | 116 | JSON |
117 | | -==== |
118 | | -Select JSON Sample: Demonstrates row insert into and query against a JSON table. |
| 117 | +---- |
| 118 | +Select JSON Sample: Demonstrates row insert into and query against a JSON table. <br> |
119 | 119 | Select JSON CLOB Sample: Demonstrates row insert into and query against a JSON table using CLOB storage. |
120 | 120 |
|
121 | 121 | LOB |
122 | | -=== |
123 | | -Sample 1: Demonstrates how to populate and obtain LOB data from a DataSet. |
124 | | -Sample 2: Demonstrates how an OracleClob object is obtained as an output parameter of an anonymous PL/SQL block. |
125 | | -Sample 3: Demonstrates how an OracleClob object is obtained from an output parameter of a stored procedure. |
126 | | -Sample 4: Demonstrates how the LOB column data can be read as a .NET type by utilizing stream reads. |
127 | | -Sample 5: Demonstrates how to bind an OracleClob object as a parameter and refetch the newly updated CLOB data using an OracleDataReader and an OracleClob object. |
128 | | -Sample 6: Demonstrates LOB updates using row-level locking. |
129 | | -Sample 7: Demonstrates LOB updates using result set locking. |
| 122 | +--- |
| 123 | +Sample 1: Demonstrates how to populate and obtain LOB data from a DataSet. <br> |
| 124 | +Sample 2: Demonstrates how an OracleClob object is obtained as an output parameter of an anonymous PL/SQL block. <br> |
| 125 | +Sample 3: Demonstrates how an OracleClob object is obtained from an output parameter of a stored procedure. <br> |
| 126 | +Sample 4: Demonstrates how the LOB column data can be read as a .NET type by utilizing stream reads. <br> |
| 127 | +Sample 5: Demonstrates how to bind an OracleClob object as a parameter and refetch the newly updated CLOB data using an OracleDataReader and an OracleClob object. <br> |
| 128 | +Sample 6: Demonstrates LOB updates using row-level locking. <br> |
| 129 | +Sample 7: Demonstrates LOB updates using result set locking. <br> |
130 | 130 | BFile Sample: Demonstrates accessing BFILEs through ODP.NET. |
131 | 131 |
|
| 132 | +OpenTelemetry |
| 133 | +------------- |
| 134 | +Sample: Demonstrates using managed ODP.NET or ODP.NET Core with OpenTelemetry |
| 135 | + |
132 | 136 | Performance Counters |
133 | | -==================== |
| 137 | +-------------------- |
134 | 138 | Sample 1: Demonstrates how to programmatically use ODP.NET performance counters. |
135 | 139 |
|
136 | 140 | Ref Cursor |
137 | | -========== |
138 | | -Sample 1: Demonstrates how a REF Cursor is obtained as an OracleDataReader. |
139 | | -Sample 2: Demonstrates how a REF Cursor is obtained as an OracleDataReader through the use of an OracleRefCursor object. |
140 | | -Sample 3: Demonstrates how multiple REF Cursors can be accessed by a single OracleDataReader. |
141 | | -Sample 4: Demonstrates how a DataSet can be populated from a REF Cursor. The sample also demonstrates how a REF Cursor can be updated. |
142 | | -Sample 5: Demonstrates how a DataSet can be populated from an OracleRefCursor object. |
143 | | -Sample 6: Demonstrates how to populate a DataSet with multiple REF Cursors selectively. |
| 141 | +---------- |
| 142 | +Sample 1: Demonstrates how a REF Cursor is obtained as an OracleDataReader. <br> |
| 143 | +Sample 2: Demonstrates how a REF Cursor is obtained as an OracleDataReader through the use of an OracleRefCursor object. <br> |
| 144 | +Sample 3: Demonstrates how multiple REF Cursors can be accessed by a single OracleDataReader. <br> |
| 145 | +Sample 4: Demonstrates how a DataSet can be populated from a REF Cursor. The sample also demonstrates how a REF Cursor can be updated. <br> |
| 146 | +Sample 5: Demonstrates how a DataSet can be populated from an OracleRefCursor object. <br> |
| 147 | +Sample 6: Demonstrates how to populate a DataSet with multiple REF Cursors selectively. <br> |
144 | 148 | Sample 7: Demonstrates how to selectively obtain OracleDataReader objects from REF Cursors. |
145 | 149 |
|
146 | 150 | Statement Cache |
147 | | -=============== |
| 151 | +--------------- |
148 | 152 | Sample 1: Demonstrates performance improvement when statement caching is enabled. |
149 | 153 |
|
150 | 154 | Transaction |
151 | | -=========== |
152 | | -Sample 1: Demonstrates the usage of EnlistTransaction API. |
153 | | -Sample 2: Demonstrates the usage of TransactionScope. |
| 155 | +----------- |
| 156 | +Sample 1: Demonstrates the usage of EnlistTransaction API. <br> |
| 157 | +Sample 2: Demonstrates the usage of TransactionScope. <br> |
154 | 158 | Sample 3: Demonstrates nested transactions with savepoints. |
155 | 159 |
|
156 | 160 | User-Defined Types (UDT) |
157 | | -======================== |
158 | | -Nested Table Sample: Demonstrates how to map, fetch, and manipulate a nested table of UDTs that has an inheritance hierarchy (i.e. parent and child types). |
159 | | -Object UDT Sample: Demonstrates how to map, fetch, and manipulate an Oracle UDT as a .NET custom object. |
160 | | -Spatial UDT Sample: Demonstrates how to map and fetch types similar to Oracle Spatial types as custom types. |
161 | | -Ref Sample: Demonstrates how to fetch UDTs referenced by REFs. |
162 | | -Ref Inheritance Sample: Demonstrates how to obtain and update Custom Type objects from OracleRef objects. |
| 161 | +------------------------ |
| 162 | +Nested Table Sample: Demonstrates how to map, fetch, and manipulate a nested table of UDTs that has an inheritance hierarchy (i.e. parent and child types). <br> |
| 163 | +Object UDT Sample: Demonstrates how to map, fetch, and manipulate an Oracle UDT as a .NET custom object. <br> |
| 164 | +Spatial UDT Sample: Demonstrates how to map and fetch types similar to Oracle Spatial types as custom types. <br> |
| 165 | +Ref Sample: Demonstrates how to fetch UDTs referenced by REFs. <br> |
| 166 | +Ref Inheritance Sample: Demonstrates how to obtain and update Custom Type objects from OracleRef objects. <br> |
163 | 167 | VARRAY Sample: Demonstrates how to map, fetch, and manipulate the Oracle VARRAY as a custom object. |
0 commit comments