Search found 8 matches

by ning
Mon 31 Dec 2012 09:17
Forum: LinqConnect (LINQ to SQL support)
Topic: How to create a Clob output parameter
Replies: 5
Views: 2119

Re: How to create a Clob output parameter

---
Or, you can try setting the value to a large string before using the parameter.
---

Are you sure this will work for a output parameter? i haven't done a full test, but in my codes it seems not work for a output parameter.

var param= cmd.CreateParameter();
param.ParameterName="foo";
param.Value=create4000LengthString(); // a string contains more than 4000 charcters.
param.Direcition= ParameterDirection.Output;

The param seems cannot get the value back.
by ning
Sat 29 Dec 2012 04:51
Forum: LinqConnect (LINQ to SQL support)
Topic: How to create a Clob output parameter
Replies: 5
Views: 2119

Re: How to create a Clob output parameter

I don;t like to write the codes using OracleParameter directly.

I wish not using the devart namespace in my codes.

For example, i can write codes like this:

IDbCommand cmd=...//get the cmd from some where, like conn.CreateCommand();
var param= cmd.CreateParameter();
param.ParameterName="foo";
param.DbType=DbType.int32;
param.Value=12;


By looking into the devart source code.
The param 's OracleDbType is set to OracleDbType.Number.
However there is no corresponding DbType that will be converted to OracleDbType.Clob.
By looking into the devart source code. I found that follow codes can create a Clob prameter.

var param= cmd.CreateParameter();
param.ParameterName="foo";
param.Value=create4000LengthString(); // a string contains more than 4000 charcters.

this can cause the param.OracleDbType to be clob. But this doesn't work if param is a output param.
by ning
Thu 27 Dec 2012 01:56
Forum: LinqConnect (LINQ to SQL support)
Topic: How to create a Clob output parameter
Replies: 5
Views: 2119

How to create a Clob output parameter

I would like avoid using OracleParameter those concreated class in my codes.

I want to use codes like below:

IDbCommand cmd=...;
var param=cmd.CreateParameter();
param.ParameterName="MyParam";
param.DbType=DbType.String;
param.Direcition= ParameterDirection.Output;
this works for most types, however i cannot do the same thing for clob, there is no corresponding DbType for Clob.
I looked into the codes, i found that when you assign a string whose length is more than 4000, OracleDbType return Clob, however in this case my parameter is an output parameter. By setting the param.Value="more than 4000 string here", it doesn't work properly.
Is there any walk around?
by ning
Thu 27 Dec 2012 01:50
Forum: LinqConnect (LINQ to SQL support)
Topic: Why DataProvider is mandatory
Replies: 6
Views: 1406

Re: Why DataProvider is mandatory

Thanks very much. i already figured this out. You are right, beside this i also implement a custom dbproviderfactory and register it in the MyOracleProvider throught the provideName property.
by ning
Sun 23 Dec 2012 05:18
Forum: LinqConnect (LINQ to SQL support)
Topic: Why DataProvider is mandatory
Replies: 6
Views: 1406

Re: Why DataProvider is mandatory

ok, Let me ask my specific question.

I would like to wrap the oracleconnect with my own connection to replace the oralcecommand, and then insert some profiler codes before and after the oraclecommand.executequery or nonquery methods.

for example, i would like to use my connection called ProfiledOracleConnection(OracleConnection con)

However, due to some reason, I cannot use dbProviderFactory, since i want to keep using one connection i created at beginning.


Then i met the issue, the DataProvider.Initial method will expect the connection to be type OracleConnection, since i use a OracleDataProvider.

Even after i created my own DataProvider and override the CreateConnection method, i found another issue saying the codes cannot explicit convert ProfiledOracleConnection to OracleConnection.

I even tried to let ProfiledOracleConnection inherit from OracleConnection, some issues came in saying that the connection is not opened.

Could you help me find a way to replace the OracleCommand with my implementation which just insert several profile codes, and be able to stick to using one connection?

I know DBMonitor can help on profile, however that's still not meet my requirement.
by ning
Thu 20 Dec 2012 01:51
Forum: LinqConnect (LINQ to SQL support)
Topic: Why DataProvider is mandatory
Replies: 6
Views: 1406

Re: Why DataProvider is mandatory

Are you suggesting the dataconnection is still not enought for the datacontext, some other properties or methods are still required thought the dataprovider in order to make the datacontext work properly.
by ning
Tue 18 Dec 2012 11:11
Forum: LinqConnect (LINQ to SQL support)
Topic: Devart.Data.Oracle.Entity
Replies: 1
Views: 973

Devart.Data.Oracle.Entity

where can i find this assembly? i installed linqconnect41pro.exe, i can not find this file in the installation folder.
by ning
Tue 18 Dec 2012 07:20
Forum: LinqConnect (LINQ to SQL support)
Topic: Why DataProvider is mandatory
Replies: 6
Views: 1406

Why DataProvider is mandatory

I would like to create a datacontext with a specified Dbconnection, means a connection has already been created before. But i found that i was asked to provide a DataProvider through the DataProviderAttribute.

Why is this mandatory? If so, does that mean the datacontext internal will not alwasy use my connection but will use the DataProvider to create a new one?