AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

CSLA Mapping Nullable (of CSLA.SmartDate) performance issues. #313

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create business object and collection of those business objects.
2. Ensure the business objects includes a datetime field.
3. Execute a BusinessObjectCollection.GetAll().
4. Run a performance profiling application over the .net code to review the
performance (I used the redgate one).
5. See screen shot attached from redgate profiler on the performance issues
with Datetime casting exceptions.

What is the expected output? What do you see instead?
I'm not sure if the Codesmith templates should define use Nullable(of
DateTime) vs the current Nullable(of SmartDate) or if the CSLA core
DataSafeReader method should be tuned to fix the performance issue.  

What version of the product are you using?
v2.0.1.1489

Please provide any additional information below.

Original issue reported on code.google.com by JenasysD...@gmail.com on 15 Mar 2010 at 12:52

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

I'll try and get this one under the profiler. Thanks for reporting this issue.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 15 Mar 2010 at 1:43

GoogleCodeExporter commented 9 years ago
Ok, even worse, if you use the criteria class to filter records based on a
Nullable(of Smart date) you will get an exception trying to execute the SP as 
the
parameter population doesn't deal with smartdate to SQL parameter conversion. 
See
Exception bellow.

  Message="DataPortal.Fetch failed (No mapping exists from object type Csla.SmartDate
to a known managed provider native type.) Stack Trace:    at
System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value,
Boolean inferLen)    at System.Data.SqlClient.SqlParameter.GetMetaTypeOnly()    
at
System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc) 
   at
System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 
startCount,
Boolean inSchema, SqlParameterCollection parameters)    at
System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, 
SqlParameterCollection
parameters, _SqlRPC& rpc)    at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior 
cmdBehavior,
RunBehavior runBehavior, Boolean returnStream, Boolean async)    at
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult 
result) 
  at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream, String method)    at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String
method)    at System.Data.SqlClient.SqlCommand.ExecuteReader()  

Original comment by JenasysD...@gmail.com on 19 Mar 2010 at 1:11

GoogleCodeExporter commented 9 years ago
Ok, I did a global change from Nullable(Of SmartDate) to Nullable(Of DateTime) 
and
it's made a significant improvement on the speed of the application. I can't 
event
get line item profiling against the Map() methods now, because they are so fast
(loading a 2,500 row collection). Obviously .net doesn't like consuming invalid 
cast
exceptions in a WPF application.

Blake I recommend that you revert to Nullable(of SmartDate) as step one. I'm 
very
happy to work with that datatype.  

Original comment by JenasysD...@gmail.com on 19 Mar 2010 at 1:48

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 19 Mar 2010 at 3:01

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 19 Mar 2010 at 3:05

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 21 Jun 2010 at 8:05

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 21 Jun 2010 at 8:06