I am working through the NUnit tests specifically with a One To One Relationship table. I had an item where the DeepLoad was failing on a time out.
The DeepLoad was trying to get an item that had been created under the transaction but not using the transaction manager.
The NUnit test also wasn't sending the transaction manager during the deepload.(this had to be done before i found the error above).
I am editing both the NUnit Tests and the DeepLoad templates... can someone point me to the procedure for sending in patches?
I am working through the NUnit tests specifically with a One To One Relationship table. I had an item where the DeepLoad was failing on a time out. The DeepLoad was trying to get an item that had been created under the transaction but not using the transaction manager. The NUnit test also wasn't sending the transaction manager during the deepload.(this had to be done before i found the error above). I am editing both the NUnit Tests and the DeepLoad templates... can someone point me to the procedure for sending in patches?
Robert Hinojosa ------------------------------------- Member of the Codesmith Tools, .netTiers, teams http://www.nettiers.com-------------------------------------
Hi,
I found the scenario where it fails, if there is an fk pointing to itself, then it fails. I've corrected the DeepLoad Load Parent entity to pass the transaction, and also included the transaction in the deepload call.
SVN Rev 447
ok - i have already been using the SVN releases. I will get the latest update and create a patch.
I have made several alterations so i will include one with all my alterations for your consideration and one with just the changes described above
on another note, I am still being left with a Timeout on my Nunit tests... this is because a couple of the tables i have have a large amount of rows (over a million) and the unit test is doing a GetAll with the default time out of 30 seconds (it took 1:29 in Server Management Studio to get all the records back)
I have noticed little support for setting the timeouts on the connections being used. It would be nice if that was supported... i could specifically up the value for this test and then return it to default. It wouldnt' be just for the tests, there are several methods that I am doing using netTiers (custom methods) that have long processing times. I had to write overrides on the inherited provider to allow for a connection timeout. The provider should probably just have a property to set.
The other thing I notice is that the CreateMockInstance is doing a GetAll on its foriegn keys even tho its only getting the first 10... but there is a GetPaged built into the system. By changing this call, my test only fails on the SelectAll rather than everything in the test.
As it turns out - the SelectAll is actually failing on a memory overflow... (collection with million+ entries will do that i guess.)
Yeah, we need to optimize to just select for paging 10 items. Tests should never ever do that.As for the timeout, there is some support for that.
There are two new options for that, 1) DefaultCommandTimeout is a property in the web.config nettiers section.
<add
name="SqlNetTiersProvider"
type="Northwind36.Data.SqlClient.SqlNetTiersProvider, Northwind36.Data.SqlClient"
connectionStringName="Northwind36.Data.ConnectionString"
providerInvariantName="System.Data.SqlClient"
entityFactoryType="Northwind36.Entities.EntityFactory"
useEntityFactory="true"
enableEntityTracking="false"
enableMethodAuthorization="false"
useStoredProcedure="false"
defaultCommandTimeout="30"/>The other:
DataRepository.Provider.DefaultCommandTimeout = 100;
And Finally:
DataRepository.OrdersProvider.DataRequesting += new NameSpace.Data.Bases.EntityProviderBaseCore<Orders, OrdersKey>.DataRequestingEventHandler(OrdersProvider_DataRequesting);
public void OrdersProvider_DataRequesting(object sender, Northwind36.Data.Bases.CommandEventArgs e)
{
e.Command.CommandTimeout = 1000;
}
nice... i like the event one...
I will keep that in mind. Thanks.
I did post my patch in the other forum.
Bummed.
Got a chance to try to use the DataRequested event to try to change the command timeout and it turns out that at least on the custom methods the event is called AFTER the execution of the query... doing very little to set the timeout of that specific command.
Is this intentional? your earlier post would indicate that it wasn't.
sure... i am a bit leary of leaving a patch as i have other modifications to this file not related to this change.
the file is Source/DataAccessLayer.SqlClient/SqlEntityProviderBase.generated.cst
my line numbers will be off due to the other changes i have but at the end of the file is a Custom Methods region. this is where the change is (starts around line 1271 in the original file) This color is the event already there. This color is the event calls I added. Hope this helps.
<% if (returnType == "DataSet") { %> DataSet ds = null; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null));
if (transactionManager != null) { ds = database.ExecuteDataSet(commandWrapper, transactionManager.TransactionObject); } else { ds = database.ExecuteDataSet(commandWrapper); } //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null));
<%=outputValues.ToString()%> return ds; <% } else if (returnType == "IDataReader") { %> IDataReader dr = null; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null));
if (transactionManager != null) { dr = Utility.ExecuteReader(transactionManager,commandWrapper); } else { dr = Utility.ExecuteReader(database, commandWrapper); }
//Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null));
<%=outputValues.ToString()%>
return dr; <% } else if (returnType == "void") { %> //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null));
if (transactionManager != null) { Utility.ExecuteNonQuery(transactionManager, commandWrapper ); } else { Utility.ExecuteNonQuery(database, commandWrapper); } //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null));
<%=outputValues.ToString()%> return; <% } else if (collectionClassName.Contains(returnType)) { %> //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "<%= methodName %>", (IEntity)null)); IDataReader reader = null;