相关疑难解决方法(0)

什么更快?结构数组或DataTable

我使用LinqToSQL处理来自SQL Server的数据,将其转储到iSeries服务器中进行进一步处理.关于这里的更多细节.

我的问题是处理这350行数据需要大约1.25分钟.我仍然试图破译SQL Server Profiler的结果,但是有一大堆查询正在运行.以下是我正在做的事情的更多细节:

using (CarteGraphDataDataContext db = new CarteGraphDataDataContext())
{
    var vehicles = from a in db.EquipmentMainGenerals
                   join b in db.EquipmentMainConditions on a.wdEquipmentMainGeneralOID equals b.wdEquipmentMainGeneralOID
                   where b.Retired == null
                   orderby a.VehicleId
                   select a;

    et = new EquipmentTable[vehicles.Count()];

    foreach (var vehicle in vehicles)
    {
       // Move data to the array

       // Rates
       GetVehcileRates(vehicle.wdEquipmentMainGeneralOID);

       // Build the costs accumulators
       GetPartsAndOilCosts(vehicle.VehicleId);
       GetAccidentAndOutRepairCosts(vehicle.wdEquipmentMainGeneralOID);

       // Last Month's Accumulators
       et[i].lastMonthActualGasOil = GetFuel(vehicle.wdEquipmentMainGeneralOID) + Convert.ToDecimal(oilCost);
       et[i].lastMonthActualParts = Convert.ToDecimal(partsCost);
       et[i].lastMonthActualLabor = GetLabor(vehicle.VehicleId);
       et[i].lastMonthActualOutRepairs = …
Run Code Online (Sandbox Code Playgroud)

c# linq-to-sql

5
推荐指数
1
解决办法
2193
查看次数

标签 统计

c# ×1

linq-to-sql ×1