Now that installation and client setup is complete, you can now start migrating your Microsoft OracleClient application code to ODP.NET. The first thing your application will need is a reference to ODP.NET.
Adding the ODP.NET namespace makes referencing ODP.NET objects easier. In this step, we will remove the Microsoft OracleClient namespace and replace it with the ODP.NET namespace.
Find the Microsoft OracleClient namespace reference and replace it with an ODP.NET reference. Optionally, if you plan to use ODP.NET-specific data types, you should add that namespace also.
C#:
using System.Data.OracleClient;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
Visual Basic:
Imports System.Data.OracleClient
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Nearly all Microsoft OracleClient connection string attributes map to ODP.NET connection string attributes. Most applications will not need to make any changes to start using ODP.NET.
To migrate to ODP.NET, remove these attributes if they are part of the Microsoft OracleClient connection string.
If you use the "Server" attribute, change its name to " Data Source" for the ODP.NET equivalent attribute.
Both Microsoft OracleClient and ODP.NET use the colon to bind parameters and bind parameters by name. While ODP.NET supports binding by name, it binds by position by default. To match Microsoft OracleClient's parameter name binding behavior, add the following line to your code after each OracleCommand instantiation that you bind parameters to:
C#:
OracleCommand.BindByName = true;
Visual Basic:
OracleCommand.BindByName = true
By now, you have completed the great majority of the work needed to migrate your Microsoft OracleClient application to ODP.NET. There are a few class differences between the two providers and any additional changes are generally straightforward. If you have any additional questions about Microsoft OracleClient to ODP.NET migration, feel free to email the ODP.NET product manager, Alex Keh (alex.keh [at] oracle.com).
Next step: ODP.NET Deployment.