While migrating to 4.0 (.net, SL, Csla) and VS10, I was messing around with all parts of my code and config files. I just noticed that my connectionString no longer has the MultipleActiveResultSets=True. And yet I am not seeing any data access errors. For example the following code continues works fine.
using (var ctx = ConnectionManager<SqlConnection>.GetManager("MyConnectionString"))
using (var cm = ctx.Connection.CreateCommand())
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "Parent_Select";
using (var dr = new SafeDataReader(cm.ExecuteReader()))
Status = "Retrieved";
this.childList1 = ChildList1.GetChildList1(this.PrimKey);
this.childList2 = ChildList2.GetChildList2(this.PrimKey);
this.childList3 = ChildList3.GetChildList3(this.PrimKey);
So, Is MARS (or using a second connection string) no longer needed? (Or do I have to call Ghostbusters!!)
I wouldn't call Dan Ackroyd just yet...
MARS enables you to have multiple DataReaders open on the same database connection. This code only shows one open DataReader, so the MARS attribute doesn't matter here.
Yeah - Now I remember.
Phew! That's a relief.
Copyright (c) Marimer LLC