c# - Binding query parameters by name with ODP.NET -


I am currently using Microsoft ADO.NET provider for Oracle ( System.Data.OracleClient < / Code>). I know that this is definitely not the best Oracle Provider available and that, I should use ODP's ODP.NET. The reason is that I still use the MS provider because ODP binds norms based on the state of the net , not by name. When you use several parameters in the query, it can actually be a PITA, because you have to be careful to add them in the right order, which can easily be bugs. For example, when you use the same parameter multiple times in the same query, it is also troublesome:

  select A, B, C, from where Fu = X : PARAM_X OR: PARAM_X = 0  

With ODP.NET, I have to add two parameters in the Oracle Commands , which I think is stupid. .

ODP The default is Oracle Commodity to change that default behavior: BindByName . When set to true, parameters are bound by name, which I want. Unfortunately, this does not really help me because:

  • It is set to false by default
  • I'm clearly convincing ADO Never use Net Classes, I like to use the ADO.NET 2.0 abstract layer ( DbProviderFactory , DbConnection , ) to reduce the coupling of a specific RDBMS Code> DbCommand ...) so I do not have access to the BindByName property, unless I explicitly remove OracleCommand , all the benefits or The abstraction is lost.
  • ASP.NET SqlDataSource, I have not created DbCommand myself, so I do not get the chance to correct BindByName (I can do it in the selection event, but this is actually There is one to do this for each SQLDiotherapeutic pain ...)

How do I handle that problem? Is there any BindByNameByDefault setting anywhere? (I could not find anything like this, but I may have missed it ...)

I think you can make your own provider that you want to use. You can easily create that provider by taking all classes from OPP.NET, just adjust some points like BindByName

DbProviderfactory will create your classes instead of normal odp.net classes


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -