Thursday, January 25, 2007
New CoDe Focus Special Issue: Sedna
EPS is about to publish a new CoDe Focus issue (CoDe Magazine special issue). It is called "Sedna: Beyond VFP 9", and that is pretty much exactly what it covers.
The cool thing is that this print magazine is completely free of charge. All you have to do to get it is sign up. However, note that the print-run is limited, and a lot of issues already are claimed. So if you are interested, make sure to sign up as quickly as possible. Here is the signup URL:
http://www.code-magazine.com/focus/interests.aspx
Make sure you indicate that you are interested in Visual FoxPro development.
Enjoy! And feel free to pass this on...
Note: We are planning a few other issues for the next months as well. The signup URL for those is the same...
Posted @ 4:29 PM by Egger, Markus (markus@code-magazine.com) - Comments
Monday, January 15, 2007
Atomic Saves and Transactions
One of our clients was having a problem with atomic saves and transactions in Milos, and it was kind of tricky to figure it out.
Business Objects were sharing the same data context so that the entities would get saved wrapped up on the same transaction. One of the Business Objects has a Business Rule that instantiates another Business Object and calls a method on it to check if a given row exists already on the database. In this scenario, the row was being added on the same transaction, but the call to this look up method was timing out (indicating that it couldn't read the row just added on the transaction. The code looked like this:
public override void VerifyRow(DataRow currentRow, int rowIndex)
{
if (!currentRow.IsNull("fkTrade"))
{
using (TradeBusinessObject oBizObj = new TradeBusinessObject())
{
Guid fkTrade = (Guid)currentRow["fkTrade"];
string tradeName = currentRow["TradeName"].ToString();
DataSet ds = oBizObj.GetList(fkTrade);
if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
this.LogBusinessRuleViolation(currentRow, rowIndex, "fkTrade", "The Trade '" + tradeName + "' does not exist.");
}
}
}
}
Notice that the TradeBusinessObject has its own data context, and therefore, the call to GetList can't seem any row created by the transaction shared by main business object where the business rule lives in. All that needs to be done in this case is to make the object share the same data context, like so (the following line must come after the object is instantiated, but before the GetList method is called on it):
oBizObj.ShareDataContext((BusinessObject)this.BusinessObject);
Posted @ 4:52 PM by Lassala, Claudio (lassala@foxbrasil.com.br) - Comments