EF codefirst with ORACLE stored procedures

Source: Internet
Author: User

EF Codefirst with ORACLE

Resolving stored procedures has not found a solution

So there was no way to use the most basic solution.

Using the ADO basic Access class provided by oracle.manageddataaccess, you do not need to refer to the third-party class library again.

Using Oracle.ManagedDataAccess.Client;

 Public Object[] Executeproc (stringProcName,paramsdbparameter[] parms) {Mydbcontext DbContext= This.            Getdbcontext (Accessmode.write); using(varconn =NewOracleConnection (dbContext.Database.Connection.ConnectionString)) {List<DbParameter> outparms = parms. Where (p = p.direction = = System.Data.ParameterDirection.Output | | p.direction = =System.Data.ParameterDirection.ReturnValue).                ToList (); OracleCommand command=NewOracleCommand (procname); Command. Connection=Conn; Command.commandtype=CommandType.StoredProcedure; Command.                Parameters.addrange (parms); Conn.                Open (); Command.                ExecuteNonQuery (); Command.                Parameters.clear (); Command.                Dispose (); Conn.                Close (); Object[] values = Outparms.select (r =r.value).                ToArray (); returnvalues; }        }

Call

New baserepository ();             var p3 = resp. Getparameterout ("count_row"4);             Object [] o = resp. Executeproc ("PROC1", p3);             var ss = P3. Value;

EF codefirst with ORACLE stored procedures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.