"Odp.net Managed" has been released for some time, recently there is a new project, want to try to use, refer to the Garden article: ". NET Oracle Developer Gospel--odp.net Managed officially launched" to the Oracle website download ODP.NET_Managed121010.zip about 1.9M, after extracting the directory structure as follows:
The core DLL, is the common directory of Oracle.ManagedDataAccess.dll, unlike the previous version of Odp.net, this time finally do not have to distinguish x86/x64 version, whether it is 32-bit or 64-bit, are the same DLL.
As for the two directories of Manged/x64, managed/x86, which are used to register assemblies with the GAC of. NET x86 or. NET x64, When the associated Configure.bat is run, the Oracle.ManagedDataAccess.dll in common is automatically placed in the GAC, which automatically finds the relevant namespaces in the GAC when you add a reference to VS
On a machine running Configure.bat, the application's Bin directory does not have to include Oracle.ManagedDataAccess.dll, and it will run normally.
Note: Configure.bat This step is optional and when you add a reference, you can completely copy the DLL to the bin directory by directly browsing the Oracle.ManagedDataAccess.dll location.
The following is the most basic code of use:
1UsingSystem;2UsingSystem.Data;3UsingOracle.ManagedDataAccess.Client;45NamespaceOdp.net6{7ClassProgram8{9Staticvoid Main (String[] args)10{OracleConnection conn =Null;12Try13{conn =Openconn ();15var cmd =Conn. CreateCommand ();Cmd.commandtext ="SELECT * FROM S_awb_master where rownum=1";Cmd.commandtype =CommandType.Text;18var reader =Cmd. ExecuteReader ();19While(Reader. Read ())20{Console.WriteLine (String. Format ("Awbpre:{0},awbno:{1}", reader["Awbpre"], reader["Awbno"]));22}23}24Catch(Exception ex)25{26Console.WriteLine (ex. Message);27}28Finally29{30CLOSECONN (conn);31}32Console.read ();33}343536StaticOracleConnection Openconn ()37{OracleConnection conn =NewOracleConnection ();Conn. ConnectionString ="Data source= (description= (address= (protocol=tcp) (host=***.***.***.***) (port=1521)) (Connect_data= (SERVICE_NAME=* **))); Persist Security info=true; User id=***; password=***;";40Conn. Open ();41ReturnConn42}4344StaticvoidCloseconn (OracleConnection conn)45{46if (conn = =NULL) {Return; }47Try48{49IF (Conn. State! =connectionstate.closed)50{51Conn. Close ();52}53}54 catch (Exception e) {56 Span style= "color: #000000;" > Console.WriteLine (e.message); 57 }58 finally59 {60 Conn. Dispose (); 61 }62 }63 }64}
Finally attach dll download: http://files.cnblogs.com/yjmyzz/Oracle.ManagedDataAccess.zip
Oracle:ODP.NET Managed Small test sledgehammer (turn)