This question is locked. New answers and comments are not allowed.
Dear guys,
this is problem:
with L2 cache enabled;
in one application add an orderline to an order;
in the other application if I read the order, the Lines collection is empty. Why? Where am I wrong?
I've got this DAL class model:
Application instance A executes the following code:
Application instance B executes the following code:
this is problem:
with L2 cache enabled;
in one application add an orderline to an order;
in the other application if I read the order, the Lines collection is empty. Why? Where am I wrong?
I've got this DAL class model:
[Telerik.OpenAccess.Persistent()] |
public class Order |
{ |
IList<OrderLine> lines; |
public IList<OrderLine> Lines { get { return lines; } } |
} |
[Telerik.OpenAccess.Persistent()] |
public class OrderLine |
{ |
Order aggregatedOrder; |
public Order AggregatedOrder { get { return aggregatedOrder; } set { aggregatedOrder = value; } } |
} |
Application instance A executes the following code:
private void button1_Click(object sender, EventArgs e) |
{ |
//add the order |
using (var scope = ObjectScopeProvider1.GetNewObjectScope()) |
{ |
try |
{ |
scope.Transaction.Begin(); |
var order = new Order(); |
scope.Add(order); |
scope.Transaction.Commit(); |
} |
catch (Exception ex) |
{ |
scope.Transaction.Rollback(); |
MessageBox.Show(ex.ToString()); |
} |
} |
} |
private void button2_Click(object sender, EventArgs e) |
{ |
//add the orderline to the order |
using (var scope = ObjectScopeProvider1.GetNewObjectScope()) |
{ |
try |
{ |
scope.Transaction.Begin(); |
var order = scope.Extent<Order>().FirstOrDefault(); |
var orderline = new OrderLine(); |
order.Lines.Add(orderline); |
scope.Transaction.Commit(); |
} |
catch (Exception ex) |
{ |
scope.Transaction.Rollback(); |
MessageBox.Show(ex.ToString()); |
} |
} |
} |
Application instance B executes the following code:
private void button4_Click(object sender, EventArgs e) |
{ |
//read and check data |
using (var scope = ObjectScopeProvider1.GetNewObjectScope()) |
{ |
try |
{ |
Order order = null; |
OrderLine orderline = null; |
order = scope.Extent<Order>().FirstOrDefault(); |
if (order != null) |
orderline = order.Lines.FirstOrDefault(); |
//!!!ordeline results to be NULL, why??? |
} |
catch (Exception ex) |
{ |
MessageBox.Show(ex.ToString()); |
} |
} |
} |