Joe,
Here is the template I came up with.
Erp.Tables.XXX XXX;
Erp.Tables.XXX_UD XXX_UD;
using (var txscope = IceDataContext.CreateDefaultTransactionScope())
{
foreach (var XXX_Recs in (from XXX_Row in Db.XXX
var XXX_Recs = (from XXX_Row in Db.XXX
from XXX_UD_Row in Db.XXX_UD
where XXX_Row.Company == Session.CompanyID
&& XXX_Row.SysRowID == XXX_UD_Row.ForeignSysRowID
&& XXX_Row.YYY == false
select new { XXX_Row, XXX_UD_Row })).FirstOrDefault();
{
if (XXX_Recs != null)
{
XXX_Recs.XXX_Row.YYY = false;
XXX_Recs.XXX_UD_Row.YYY = false;
Db.Validate(XXX_Recs.XXX_Row);
Db.Validate(XXX_Recs.XXX_UD_Row);
}
} /*** XXX ***/
txscope.Complete();
}
Brenda
From:
vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, October 29, 2014 5:13 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] E10: Handling database updates in method directives
Thanks again Jose.
I will give it a whirl with how the converter created the code and if I run into any issues, I will try using
Db.Validate()
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... |
www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:fa4635.png@c38de3e2.43a98261]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that
any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, October 29, 2014 5:00 PM
To: Vantage
Subject: Re: [Vantage] E10: Handling database updates in method directives
Look at page 33 of the converted code guide and see if that helps any... it kind of does.. sort of.
Jose C Gomez
Software Engineer
T: 904.469.1524 mobile
E: jose@...<mailto:jose@...>
http://www.josecgomez.com
[Image removed by sender.]<http://www.linkedin.com/in/josecgomez> [Image removed by sender.] <http://www.facebook.com/josegomez> [Image removed by sender.] <http://www.google.com/profiles/jose.gomez>
[Image removed by sender.] <http://www.twitter.com/joc85> [Image removed by sender.] <http://www.josecgomez.com/professional-resume/> [Image removed by
sender.] <http://www.josecgomez.com/feed/>
Quis custodiet
ipsos custodes?
On Wed, Oct 29, 2014 at 4:39 PM, Joe Rojas
jrojas@...<mailto:jrojas@...> [vantage] <vantage@yahoogroups.com<mailto:vantage@yahoogroups.com>> wrote:
Hello,
I’ve been using the ABL to C# converter with pretty good success so far…well the method directives are compiling at least.
I’ve notice an inconsistency in how the converted code handles database updates.
If I have a linq statement that pulls data from a table in the database, let’s say JobHead, and then update a field in JobHead, sometimes there is no Db command afterwards and sometimes there is.
For example,
If I have an assign statement like:
JobHead["ShortChar01"] = (string)OrderRel["ShortChar01"];
Assuming that JobHead is a variable containing a row from a linq statement that pulled data from Db.JobHead, I’ve seen a couple of statements appear after this converted line.
I have seen nothing related to a database update.
I have seen: Db.JobHead.Update(JobHead)
And I’ve also seen: Db.Release(ref PORel)
The last one is concerning because “Release†does not sound like a save.
I thought I had read that method directives are already “wrapped†in a transaction from a higher level, which should prevent me from having to explicit commit the change to the database but I can’t find a definitive answer.
Anyone know? :)
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291<tel:781-573-0291> | cell: 781-408-9278<tel:781-408-9278> | fax: 781-232-5191<tel:781-232-5191>
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@...<mailto:jrojas@...> |
www.matsinc.com<http://www.matsinc.com>
Ask us about our clean, green and beautiful matting and flooring
[cid:f8dafb.png@75c91b0f.458f8c19]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that
any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]