Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CommandBehavior.SchemaOnly
Message
De
30/07/2013 15:19:39
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01579375
Message ID:
01579478
Vues:
32
>>>>>Viv,
>>>>>
>>>>>After I switched to List and Linq, the performance is 10 times slower than it was :( The procedure used to execute in ~800 ms. Now it executes in 8000 ms.
>>>>
>>>>As John says, must be something else going on. Linq should be faster then a coded iteration....
>>>
>>>Right, I bet the problem is here with the CAST (that's what I was getting yesterday night)
>>>
>>>
>>> columns = (from DataRow r in reader.GetSchemaTable().AsEnumerable()
>>>                                                  select new ColumnSchema
>>>                                                      {
>>>                                                          ColumnName = (String) r["ColumnName"],
>>>                                                          ColumnSize = (Int32) r["ColumnSize"],
>>>                                                          DbType = (SqlDbType) r["ProviderType"],
>>>                                                          DataType = reader.GetFieldType((int)r["ColumnOrdinal"]),
>>>                                                          Precision = (Int16) r["NumericPrecision"],
>>>                                                          Scale = (Int16) r["NumericScale"],
>>>                                                          IsIdentity = (Boolean) r["IsIdentity"]
>>>                                                      }).ToList();
>>>
>>>I am going to debug it in a few minutes and see what needs to be adjusted.
>>
>>Why are you using reader.GetFieldType((int)r["ColumnOrdinal"]) rather than (Type) r["DataType"] ?
>
>Did you see yesterday's post from Bill F message #1579381? There is no DataType property in TableSchema in .NET 4.5 according to documentation. I'm using .NET 4.0 right now, so I haven't verified.

Just checked - works in 4.5 (I'd be very surprised if it didn't)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform