This question is locked. New answers and comments are not allowed.
hello together,
I'm testing telerik and have the following problem.
I want to insert all missing records from table "order" in table "orderXML".
Table order
BetrNr Char(6), (primary key)
BelegNr int, (primary key)
Lieferant int,
.....
Table order XML
BetrNr Char(6), (primary key)
BelegNr int, (primary key)
uebertrage int ,
erledigt int ,
.....
I can identify all the missing records and also insert:
IQueryable<BESTELLKOPF> query = from b in dbContext.orders
.Include(hms => hms.orderXML)
join r in dbContext.orders
on b.BelegNr equals r.BELEGNR into temp
from t in temp.DefaultIfEmpty()
where b.BetrNr == "100000" &&
b.Lieferant == 69 &&
(t.BETRNR == null ||
t.ISTERLEDIGT == 0)
select b;
// jetzt alle nicht enthaltenen Sätze in orderXML einfügen
foreach (order bestellung in query)
{
if (bestellung.orderXML == null)
{
orderXML hms = new HMS_BESTELLXML();
hms.BETRNR = bestellung.BetrNr;
hms.BELEGNR = bestellung.BelegNr;
hms.ISTERLEDIGT = 0;
hms.ISTUEBERTRAGEN = 0;
hms.BEMERKUNG = "";
brz.Add(hms);
}
}
dbContext.SaveChanges();
this works fine.
But if another program deletes records from the table "orderXML" the following error occurs:
Error duplicate Key; already exists in the cache of the object scope
I have tried the following
dbContext.cache.releaseAll();
dbContext.cache.release(dbContext.orderXMLs);
set the property "cache Policy" of orderXML to "NoCache"
Kind regards
Harm
I'm testing telerik and have the following problem.
I want to insert all missing records from table "order" in table "orderXML".
Table order
BetrNr Char(6), (primary key)
BelegNr int, (primary key)
Lieferant int,
.....
Table order XML
BetrNr Char(6), (primary key)
BelegNr int, (primary key)
uebertrage int ,
erledigt int ,
.....
I can identify all the missing records and also insert:
IQueryable<BESTELLKOPF> query = from b in dbContext.orders
.Include(hms => hms.orderXML)
join r in dbContext.orders
on b.BelegNr equals r.BELEGNR into temp
from t in temp.DefaultIfEmpty()
where b.BetrNr == "100000" &&
b.Lieferant == 69 &&
(t.BETRNR == null ||
t.ISTERLEDIGT == 0)
select b;
// jetzt alle nicht enthaltenen Sätze in orderXML einfügen
foreach (order bestellung in query)
{
if (bestellung.orderXML == null)
{
orderXML hms = new HMS_BESTELLXML();
hms.BETRNR = bestellung.BetrNr;
hms.BELEGNR = bestellung.BelegNr;
hms.ISTERLEDIGT = 0;
hms.ISTUEBERTRAGEN = 0;
hms.BEMERKUNG = "";
brz.Add(hms);
}
}
dbContext.SaveChanges();
this works fine.
But if another program deletes records from the table "orderXML" the following error occurs:
Error duplicate Key; already exists in the cache of the object scope
I have tried the following
dbContext.cache.releaseAll();
dbContext.cache.release(dbContext.orderXMLs);
set the property "cache Policy" of orderXML to "NoCache"
Kind regards
Harm