DataContex.Refresh gets the record one by one instead of ref

DataContex.Refresh gets the record one by one instead of ref

Postby afva » Wed 18 Aug 2010 16:13

Hello,

I have a button with wich the customer can refresh a complete table (CT_RELATIES) with the values from the database.

I call:
DB.Refresh(RefreshMode.OverwriteCurrentValues, DB.CT_RELATIES);

This takes quit some time, although the table only contains 39 records.
When I fill the table for the first time I use the statement:
SELECT t1.ID, ......
FROM UPLUS.CT_RELATIES t1

When I ask for the refresh I can see in the output-window, that the records are fetched one at the time (so I see 39 times the statement:
SELECT t1.ID, .....
FROM UPLUS.CT_RELATIES t1
WHERE ID = :np0
ParameterName = np0
DbType = Decimal
Value = 1126
)
That probably explains why it is so slow.

How can I refresh the whole table in one time?

Thanks
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22

Postby afva » Fri 20 Aug 2010 11:39

Now this is strange!
I have 2 methods to fill my tabel (ct_relaties):
public IEnumerable GetAll()
{
return DB.CT_RELATIES;
}
AND
public IEnumerable Test()
{
var q = from c in DB.CT_RELATIES
select c;
return q;
}

When I call either of the methods, the result is the same: 1 select-statement to the database:
SELECT t1.ID, t1.CODE, ...
FROM UPLUS.CT_RELATIES t1

But When I call a refresh like:
public override void RefreshFromDb()
{
DB.Refresh(RefreshMode.OverwriteCurrentValues, this.GetAll());
}
The result is: multiple calls to the datebase (For each record one call) like:

SELECT t1.ID, t1.CODE, ...
FROM UPLUS.CT_RELATIES t1
WHERE ID = :np0
ParameterName = np0
DbType = Decimal
Value = 1126


When I call a refresh like:
public override void RefreshFromDb()
{
DB.Refresh(RefreshMode.OverwriteCurrentValues, Test());
}
the result is (as expected) 1 call to the database.

Now I wonder: what is the difference?
Can anybody explain this?

Thanks in advance
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22

Postby StanislavK » Fri 20 Aug 2010 16:06

I will send you a sample in a letter, please check that it was not blocked by your mail filter. Please specify what should be changed in the sample to reproduce the problem or send us your test project.

We couldn't reproduce the problem with simple tables, the Refresh method always generates queries like
Code: Select all
SELECT t1.DEPTNO, t1.DNAME, t1.LOC
FROM DEPT t1

in our environment.

The table used in the sample can be created as
Code: Select all
CREATE TABLE DEPT (
  DEPTNO NUMBER(4),
  DNAME VARCHAR2(14),
  LOC VARCHAR2(13),
  CONSTRAINT PK_DEPT PRIMARY KEY (DEPTNO)
)

P.S.: I've deleted the duplicate topic in the dotConnect for Oracle forum.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby afva » Fri 20 Aug 2010 17:54

Thank you for your reply, StanislavK

I send you a copy of my results (of your test-program) to your mail-box.
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22

Postby StanislavK » Sat 21 Aug 2010 14:08

Thank you for the sample. In our environment, all cases generated a single select statement. Could you please specify the following:
- the version of dotConnect for Oracle you are using;
- the version of Oracle server to which you are connecting;
- whether you use the Direct or OCI connection mode;
- in the case of the OCI mode, the version of Oracle client.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby afva » Wed 15 Sep 2010 09:37

Problem is solved in newer version (Devart dotConnect for Oracle 6.0.10.0)

Thank you for your help.
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22


Return to LinqConnect (LINQ to SQL support)