0

I built a page that allows the user to edit all the information presented in a contract.

I separated all main parts of the contract in different forms (in the same page). This makes it possible to submit/save a section only, but also to save the whole contract. When I want to save all forms at once, I serialize the data and I post it to the controller using ajax.

var data = $("#ContractHeader").serialize();
data += $("ContractMandatoryItems").serialize();
...

I have an action (form receiver) for every part of the contract and those actions get called miliseconds after clicking "Save this section". However, when I save the whole contract it takes forever before my controller's action is called (5-10 seconds). This delays happens between the ajax "post" call in my browser and the breakpoint on the 1st line of my save action. As you may ask, here is the signature one action that is responsable of saving a section:

public ActionResult SaveConcreteItems(IList<PreparedConcreteContractItem> ConcreteItems, int ConcreteContractId)

Now, here is the signature of the "full save" action :

        public ActionResult SaveContract(
        PreparedConcreteContract contractHeader, 
        IList<PreparedConcreteContractItem> ConcreteItems,
        IList<PreparedConcreteContractItem> ExtraItems,
        IList<PreparedConcreteContractItem> AdjuvantItems,
        IList<PreparedConcreteContractItem> OptionalItems,
        IList<PreparedConcreteContractItem> ServiceItems,
        IList<PreparedConcreteContractItem> NoteItems,
        IList<PreparedConcreteContractNote> ContractNotes,
        string SelectedAdditionalLocations)

I tried modifying this "SaveContract" action so it takes only 1 of it's actual parameter and every time the action is called in no time.

As soon as it has more than 1 parameter it takes a while to load (even if the added parameter contains nearly no information).

I also tested if the volume of data had an influence. It does not. I can save the "madatoryItems" section in no time even if has 50 items in it, while a small complete contract (about the same amount of data) will take about 10 seconds to hit the server.

All this happens in development. It's not a "database performance" or save logic issue. The whole delay happens before the action is called. It seems to be the parameters binding that is slow but I have no idea why.

I don't know if it might have an impact on your answer but I noticed a lot of "first time exception" when I have more than 1 section to save. Snipped below shows a few lines but there were 150+.

A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in System.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll

Thanks in advance!

I've been asked to add post data for a given full save... I updated my question tu use the real save methods (instead of a simpler one I used to simplify my post). Here is the real data posted (as shown in chrome). Notice that this contract only had ConcreteItems).

StatusId_VI:N
StatusId:Soumission
StatusId_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
StatusId$DDD$L:N
CustomerId:1111
ProjectName:Name of my project
ShipToAddress1:AddressA
ShipToAddress2:AddressB
ShipToCity_VI:Vancouver
ShipToCity:Vancouver
ShipToCity_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
ShipToCity_DDD_LDeletedItems:
ShipToCity_DDD_LInsertedItems:
ShipToCity_DDD_LCustomCallback:
ShipToCity$DDD$L:Vancouver
ShipToState_VI:BC
ShipToState:British Columbia
ShipToState_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
ShipToState_DDD_LDeletedItems:
ShipToState_DDD_LInsertedItems:
ShipToState_DDD_LCustomCallback:
ShipToState$DDD$L:BC
ShipToZip:A2A 2A2
ProductionLocationNumber_VI:093
ProductionLocationNumber:ThisValueIsRemovedForS/OPost
ProductionLocationNumber_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
ProductionLocationNumber_DDD_LDeletedItems:
ProductionLocationNumber_DDD_LInsertedItems:
ProductionLocationNumber_DDD_LCustomCallback:
ProductionLocationNumber$DDD$L:093
DeliveryZone_VI:1
DeliveryZone:1 (0.00$)
DeliveryZone_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
DeliveryZone$DDD$L:1
SelectedAdditionalLocations:
LocationClosedFrom_Raw:N
LocationClosedFrom:
LocationClosedFrom_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
LocationClosedFrom_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
LocationClosedFrom$DDD$C:11/06/2013
LocationClosedTo_Raw:N
LocationClosedTo:
LocationClosedTo_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
LocationClosedTo_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
LocationClosedTo$DDD$C:11/06/2013
ShipToCellphone:
ContractId:9801
ContractNumber:9801
RiscContractNumber:
PurchaseOrderNumber:
StartDate_Raw:1356998400000
StartDate:2013-01-01
StartDate_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
StartDate_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
StartDate$DDD$C:01/01/2013:01/01/2013
EndDate_Raw:1356998400000
EndDate:2013-01-01
EndDate_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
EndDate_DDD_C_FNPWS:0:0:-1:-10000:-10000:0:0px:-10000:1:0:0:0
EndDate$DDD$C:01/01/2013:01/01/2013
IsGeneral:U
LanguageId_VI:FR
LanguageId:Français
LanguageId_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
LanguageId$DDD$L:FR
AttentionOf:
SalespersonNumber_VI:
SalespersonNumber:
SalespersonNumber_DDDWS:0:0:-1:-10000:-10000:0:-10000:-10000:1:0:0:0
SalespersonNumber_DDD_LDeletedItems:
SalespersonNumber_DDD_LInsertedItems:
SalespersonNumber_DDD_LCustomCallback:
SalespersonNumber$DDD$L:
CreatedBy:
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22
DXMVCEditorsValues:{"StatusId_DDD_L":["N"],"StatusId":"N","ProjectName":"Name of my project","ShipToAddress1":"AddressA","ShipToAddress2":"AddressB","ShipToCity_DDD_L":["Vancouver"],"ShipToCity":"Vancouver","ShipToState_DDD_L":["BC"],"ShipToState":"BC","ShipToZip":"A2A 2A2","ProductionLocationNumber_DDD_L":["093"],"ProductionLocationNumber":"093","DeliveryZone_DDD_L":["1"],"DeliveryZone":"1","LocationClosedFrom_DDD_C":null,"LocationClosedFrom":null,"LocationClosedTo_DDD_C":null,"LocationClosedTo":null,"ShipToCellphone":null,"ContractNumber":"9801","RiscContractNumber":null,"PurchaseOrderNumber":null,"StartDate_DDD_C":new Date(2013,0,1),"StartDate":new Date(2013,0,1),"EndDate_DDD_C":new Date(2013,0,1),"EndDate":new Date(2013,0,1),"IsGeneral":false,"LanguageId_DDD_L":["FR"],"LanguageId":"FR","AttentionOf":null,"SalespersonNumber_DDD_L":[],"SalespersonNumber":null,"CreatedBy":null}ConcreteContractId
ConcreteProductTypeGroup:Concrete
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22ExtraContractId
ExtraProductTypeGroup:Extra
ExtraItems[0].ItemId:243123
ExtraItems[0].IncludeInContract:U
ExtraItems[0].IncludeInPrice:U
ExtraItems[0].NoCharge:U
ExtraItems[0].PriceNotAvailable:U
ExtraItems[0].UnitPrice:0.00
ExtraItems[0].UnitDiscount:0.00
ExtraItems[0].DiscountPercentage:0.00
ExtraItems[1].ItemId:243124
ExtraItems[1].IncludeInContract:U
ExtraItems[1].IncludeInPrice:U
ExtraItems[1].NoCharge:U
ExtraItems[1].PriceNotAvailable:U
ExtraItems[1].UnitPrice:0.00
ExtraItems[1].UnitDiscount:0.00
ExtraItems[1].DiscountPercentage:0.00
ExtraItems[2].ItemId:243125
ExtraItems[2].IncludeInContract:U
ExtraItems[2].IncludeInPrice:U
ExtraItems[2].NoCharge:U
ExtraItems[2].PriceNotAvailable:U
ExtraItems[2].UnitPrice:8.00
ExtraItems[2].UnitDiscount:0.00
ExtraItems[2].DiscountPercentage:0.00
ExtraItems[3].ItemId:243126
ExtraItems[3].IncludeInContract:U
ExtraItems[3].IncludeInPrice:U
ExtraItems[3].NoCharge:U
ExtraItems[3].PriceNotAvailable:U
ExtraItems[3].UnitPrice:45.00
ExtraItems[3].UnitDiscount:0.00
ExtraItems[3].DiscountPercentage:0.00
ExtraItems[4].ItemId:243127
ExtraItems[4].IncludeInContract:U
ExtraItems[4].IncludeInPrice:U
ExtraItems[4].NoCharge:U
ExtraItems[4].PriceNotAvailable:U
ExtraItems[4].UnitPrice:0.00
ExtraItems[4].UnitDiscount:0.00
ExtraItems[4].DiscountPercentage:0.00
ExtraItems[5].ItemId:243128
ExtraItems[5].IncludeInContract:U
ExtraItems[5].IncludeInPrice:U
ExtraItems[5].NoCharge:U
ExtraItems[5].PriceNotAvailable:U
ExtraItems[5].UnitPrice:0.00
ExtraItems[5].UnitDiscount:0.00
ExtraItems[5].DiscountPercentage:0.00
ExtraItems[6].ItemId:243129
ExtraItems[6].IncludeInContract:U
ExtraItems[6].IncludeInPrice:U
ExtraItems[6].NoCharge:U
ExtraItems[6].PriceNotAvailable:U
ExtraItems[6].UnitPrice:12.00
ExtraItems[6].UnitDiscount:0.00
ExtraItems[6].DiscountPercentage:0.00
ExtraItems[7].ItemId:243130
ExtraItems[7].IncludeInContract:U
ExtraItems[7].IncludeInPrice:U
ExtraItems[7].NoCharge:U
ExtraItems[7].PriceNotAvailable:U
ExtraItems[7].UnitPrice:18.00
ExtraItems[7].UnitDiscount:0.00
ExtraItems[7].DiscountPercentage:0.00
ExtraItems[8].ItemId:243131
ExtraItems[8].IncludeInContract:U
ExtraItems[8].IncludeInPrice:U
ExtraItems[8].NoCharge:U
ExtraItems[8].PriceNotAvailable:U
ExtraItems[8].UnitPrice:7.00
ExtraItems[8].UnitDiscount:0.00
ExtraItems[8].DiscountPercentage:0.00
ExtraItems[9].ItemId:243132
ExtraItems[9].IncludeInContract:U
ExtraItems[9].IncludeInPrice:U
ExtraItems[9].NoCharge:U
ExtraItems[9].PriceNotAvailable:U
ExtraItems[9].UnitPrice:15.00
ExtraItems[9].UnitDiscount:0.00
ExtraItems[9].DiscountPercentage:0.00
ExtraItems[10].ItemId:243133
ExtraItems[10].IncludeInContract:U
ExtraItems[10].IncludeInPrice:U
ExtraItems[10].NoCharge:U
ExtraItems[10].PriceNotAvailable:U
ExtraItems[10].UnitPrice:0.00
ExtraItems[10].UnitDiscount:0.00
ExtraItems[10].DiscountPercentage:0.00
ExtraItems[11].ItemId:243134
ExtraItems[11].IncludeInContract:U
ExtraItems[11].IncludeInPrice:U
ExtraItems[11].NoCharge:U
ExtraItems[11].PriceNotAvailable:U
ExtraItems[11].UnitPrice:100.00
ExtraItems[11].UnitDiscount:0.00
ExtraItems[11].DiscountPercentage:0.00
ExtraItems[12].ItemId:243135
ExtraItems[12].IncludeInContract:U
ExtraItems[12].IncludeInPrice:U
ExtraItems[12].NoCharge:U
ExtraItems[12].PriceNotAvailable:U
ExtraItems[12].UnitPrice:12.00
ExtraItems[12].UnitDiscount:0.00
ExtraItems[12].DiscountPercentage:0.00
ExtraItems[13].ItemId:243136
ExtraItems[13].IncludeInContract:U
ExtraItems[13].IncludeInPrice:U
ExtraItems[13].NoCharge:U
ExtraItems[13].PriceNotAvailable:U
ExtraItems[13].UnitPrice:0.00
ExtraItems[13].UnitDiscount:0.00
ExtraItems[13].DiscountPercentage:0.00
ExtraItems[14].ItemId:243137
ExtraItems[14].IncludeInContract:U
ExtraItems[14].IncludeInPrice:U
ExtraItems[14].NoCharge:U
ExtraItems[14].PriceNotAvailable:U
ExtraItems[14].UnitPrice:10.00
ExtraItems[14].UnitDiscount:0.00
ExtraItems[14].DiscountPercentage:0.00
ExtraItems[15].ItemId:243138
ExtraItems[15].IncludeInContract:U
ExtraItems[15].IncludeInPrice:U
ExtraItems[15].NoCharge:U
ExtraItems[15].PriceNotAvailable:U
ExtraItems[15].UnitPrice:0.00
ExtraItems[15].UnitDiscount:0.00
ExtraItems[15].DiscountPercentage:0.00
ExtraItems[16].ItemId:243139
ExtraItems[16].IncludeInContract:U
ExtraItems[16].IncludeInPrice:U
ExtraItems[16].NoCharge:U
ExtraItems[16].PriceNotAvailable:U
ExtraItems[16].UnitPrice:1.00
ExtraItems[16].UnitDiscount:0.00
ExtraItems[16].DiscountPercentage:0.00
ExtraItems[17].ItemId:243140
ExtraItems[17].IncludeInContract:U
ExtraItems[17].IncludeInPrice:U
ExtraItems[17].NoCharge:U
ExtraItems[17].PriceNotAvailable:U
ExtraItems[17].UnitPrice:2.00
ExtraItems[17].UnitDiscount:0.00
ExtraItems[17].DiscountPercentage:0.00
ExtraItems[18].ItemId:243141
ExtraItems[18].IncludeInContract:U
ExtraItems[18].IncludeInPrice:U
ExtraItems[18].NoCharge:U
ExtraItems[18].PriceNotAvailable:U
ExtraItems[18].UnitPrice:3.00
ExtraItems[18].UnitDiscount:0.00
ExtraItems[18].DiscountPercentage:0.00
ExtraItems[19].ItemId:243142
ExtraItems[19].IncludeInContract:U
ExtraItems[19].IncludeInPrice:U
ExtraItems[19].NoCharge:U
ExtraItems[19].PriceNotAvailable:U
ExtraItems[19].UnitPrice:35.00
ExtraItems[19].UnitDiscount:0.00
ExtraItems[19].DiscountPercentage:0.00
ExtraItems[20].ItemId:243143
ExtraItems[20].IncludeInContract:U
ExtraItems[20].IncludeInPrice:U
ExtraItems[20].NoCharge:U
ExtraItems[20].PriceNotAvailable:U
ExtraItems[20].UnitPrice:0.00
ExtraItems[20].UnitDiscount:0.00
ExtraItems[20].DiscountPercentage:0.00
ExtraItems[21].ItemId:243144
ExtraItems[21].IncludeInContract:U
ExtraItems[21].IncludeInPrice:U
ExtraItems[21].NoCharge:U
ExtraItems[21].PriceNotAvailable:U
ExtraItems[21].UnitPrice:0.00
ExtraItems[21].UnitDiscount:0.00
ExtraItems[21].DiscountPercentage:0.00
ExtraItems[22].ItemId:243145
ExtraItems[22].IncludeInContract:U
ExtraItems[22].IncludeInPrice:U
ExtraItems[22].NoCharge:U
ExtraItems[22].PriceNotAvailable:U
ExtraItems[22].UnitPrice:15.00
ExtraItems[22].UnitDiscount:0.00
ExtraItems[22].DiscountPercentage:0.00
ExtraItems[23].ItemId:243146
ExtraItems[23].IncludeInContract:U
ExtraItems[23].IncludeInPrice:U
ExtraItems[23].NoCharge:U
ExtraItems[23].PriceNotAvailable:U
ExtraItems[23].UnitPrice:0.00
ExtraItems[23].UnitDiscount:0.00
ExtraItems[23].DiscountPercentage:0.00
ExtraItems[24].ItemId:243147
ExtraItems[24].IncludeInContract:U
ExtraItems[24].IncludeInPrice:U
ExtraItems[24].NoCharge:U
ExtraItems[24].PriceNotAvailable:U
ExtraItems[24].UnitPrice:8.00
ExtraItems[24].UnitDiscount:0.00
ExtraItems[24].DiscountPercentage:0.00
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22
DXMVCEditorsValues:{"ExtraItems[0].IncludeInContract":false,"ExtraItems[0].IncludeInPrice":false,"ExtraItems[0].NoCharge":false,"ExtraItems[0].PriceNotAvailable":false,"ExtraItems[1].IncludeInContract":false,"ExtraItems[1].IncludeInPrice":false,"ExtraItems[1].NoCharge":false,"ExtraItems[1].PriceNotAvailable":false,"ExtraItems[2].IncludeInContract":false,"ExtraItems[2].IncludeInPrice":false,"ExtraItems[2].NoCharge":false,"ExtraItems[2].PriceNotAvailable":false,"ExtraItems[3].IncludeInContract":false,"ExtraItems[3].IncludeInPrice":false,"ExtraItems[3].NoCharge":false,"ExtraItems[3].PriceNotAvailable":false,"ExtraItems[4].IncludeInContract":false,"ExtraItems[4].IncludeInPrice":false,"ExtraItems[4].NoCharge":false,"ExtraItems[4].PriceNotAvailable":false,"ExtraItems[5].IncludeInContract":false,"ExtraItems[5].IncludeInPrice":false,"ExtraItems[5].NoCharge":false,"ExtraItems[5].PriceNotAvailable":false,"ExtraItems[6].IncludeInContract":false,"ExtraItems[6].IncludeInPrice":false,"ExtraItems[6].NoCharge":false,"ExtraItems[6].PriceNotAvailable":false,"ExtraItems[7].IncludeInContract":false,"ExtraItems[7].IncludeInPrice":false,"ExtraItems[7].NoCharge":false,"ExtraItems[7].PriceNotAvailable":false,"ExtraItems[8].IncludeInContract":false,"ExtraItems[8].IncludeInPrice":false,"ExtraItems[8].NoCharge":false,"ExtraItems[8].PriceNotAvailable":false,"ExtraItems[9].IncludeInContract":false,"ExtraItems[9].IncludeInPrice":false,"ExtraItems[9].NoCharge":false,"ExtraItems[9].PriceNotAvailable":false,"ExtraItems[10].IncludeInContract":false,"ExtraItems[10].IncludeInPrice":false,"ExtraItems[10].NoCharge":false,"ExtraItems[10].PriceNotAvailable":false,"ExtraItems[11].IncludeInContract":false,"ExtraItems[11].IncludeInPrice":false,"ExtraItems[11].NoCharge":false,"ExtraItems[11].PriceNotAvailable":false,"ExtraItems[12].IncludeInContract":false,"ExtraItems[12].IncludeInPrice":false,"ExtraItems[12].NoCharge":false,"ExtraItems[12].PriceNotAvailable":false,"ExtraItems[13].IncludeInContract":false,"ExtraItems[13].IncludeInPrice":false,"ExtraItems[13].NoCharge":false,"ExtraItems[13].PriceNotAvailable":false,"ExtraItems[14].IncludeInContract":false,"ExtraItems[14].IncludeInPrice":false,"ExtraItems[14].NoCharge":false,"ExtraItems[14].PriceNotAvailable":false,"ExtraItems[15].IncludeInContract":false,"ExtraItems[15].IncludeInPrice":false,"ExtraItems[15].NoCharge":false,"ExtraItems[15].PriceNotAvailable":false,"ExtraItems[16].IncludeInContract":false,"ExtraItems[16].IncludeInPrice":false,"ExtraItems[16].NoCharge":false,"ExtraItems[16].PriceNotAvailable":false,"ExtraItems[17].IncludeInContract":false,"ExtraItems[17].IncludeInPrice":false,"ExtraItems[17].NoCharge":false,"ExtraItems[17].PriceNotAvailable":false,"ExtraItems[18].IncludeInContract":false,"ExtraItems[18].IncludeInPrice":false,"ExtraItems[18].NoCharge":false,"ExtraItems[18].PriceNotAvailable":false,"ExtraItems[19].IncludeInContract":false,"ExtraItems[19].IncludeInPrice":false,"ExtraItems[19].NoCharge":false,"ExtraItems[19].PriceNotAvailable":false,"ExtraItems[20].IncludeInContract":false,"ExtraItems[20].IncludeInPrice":false,"ExtraItems[20].NoCharge":false,"ExtraItems[20].PriceNotAvailable":false,"ExtraItems[21].IncludeInContract":false,"ExtraItems[21].IncludeInPrice":false,"ExtraItems[21].NoCharge":false,"ExtraItems[21].PriceNotAvailable":false,"ExtraItems[22].IncludeInContract":false,"ExtraItems[22].IncludeInPrice":false,"ExtraItems[22].NoCharge":false,"ExtraItems[22].PriceNotAvailable":false,"ExtraItems[23].IncludeInContract":false,"ExtraItems[23].IncludeInPrice":false,"ExtraItems[23].NoCharge":false,"ExtraItems[23].PriceNotAvailable":false,"ExtraItems[24].IncludeInContract":false,"ExtraItems[24].IncludeInPrice":false,"ExtraItems[24].NoCharge":false,"ExtraItems[24].PriceNotAvailable":false}AdjuvantContractId
AdjuvantProductTypeGroup:Adjuvant
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22OptionalContractId
OptionalProductTypeGroup:Optional
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22ServiceContractId
ServiceProductTypeGroup:Service
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22contractNotes[0].NoteId
contractNotes[0].ItemId:9801
contractNotes[0].Value:
contractNotes[1].NoteId:0
contractNotes[1].ItemId:9801
contractNotes[1].Value:
contractNotes[2].NoteId:0
contractNotes[2].ItemId:9801
contractNotes[2].Value:
contractNotes[3].NoteId:0
contractNotes[3].ItemId:9801
contractNotes[3].Value:
contractNotes[4].NoteId:0
contractNotes[4].ItemId:9801
contractNotes[4].Value:
contractNotes[5].NoteId:0
contractNotes[5].ItemId:9801
contractNotes[5].Value:
contractNotes[6].NoteId:0
contractNotes[6].ItemId:9801
contractNotes[6].Value:
contractNotes[7].NoteId:0
contractNotes[7].ItemId:9801
contractNotes[7].Value:
contractNotes[8].NoteId:0
contractNotes[8].ItemId:9801
contractNotes[8].Value:
contractNotes[9].NoteId:0
contractNotes[9].ItemId:9801
contractNotes[9].Value:
DXScript:1_145,1_81,1_137,1_99,1_106,1_98,1_130,14_25,14_5,1_78,1_128,1_101,1_85,1_110,1_93,14_1,1_95,1_80,14_2,1_88,14_7,1_90,1_89,14_8,1_143,1_114,1_144,1_109,14_9,1_136,1_135,1_121,14_24,1_131,1_140,1_118,1_120,14_15,1_129,1_123,14_16,14_18,1_127,1_134,1_138,14_21,14_23,1_87,5_5,5_4,4_11,4_10,4_6,4_7,4_9,14_12,4_5,4_12,4_13,1_97,1_91,1_139,1_115,14_11,1_126,1_133,7_51,1_83,7_53,14_17,1_92,1_102,14_0,1_105,1_94,14_3,1_96,1_107,1_119,1_104,14_13,14_14,1_103,1_108,10_2,10_1,10_3,10_4,14_4,9_1,9_5,14_19,9_4,8_10,8_17,8_24,8_26,8_9,8_12,8_13,8_18,14_20,8_21,8_23,8_22,8_16,8_19,8_20,8_14,8_15,8_25,8_11,6_12,14_22

Edit #2

I finally found the problem.

In one word, using classic checkboxes instead of DevExpress' checkboxes solved the issue.

I still don't know why, but it seems that DevExpress' binder had some trouble with the following conditions were met:

  • Multiple objects are sent to the action (multiple action parameters)
  • One of the parameter is an array (IList) containing values from a DevExpress control (checkbox in my case)

As soon as I had more than one parameter to my form reciever action "first chance exception" were generated in the output console. Strangely, when only 1 parameter was posted (single section save) no exception was shown.

Now that I use classic checkboxes everything works fine and it's fast as lightning!

Nick102
  • 21
  • 3
  • I recommend starting with a working example of an MVC wizard control. http://stackoverflow.com/questions/771788/how-do-i-create-a-mvc-wizard-similar-in-functionality-to-webforms-wizards Or http://afana.me/post/create-wizard-in-aspnet-mvc-3.aspx – P.Brian.Mackey Nov 06 '13 at 15:10
  • Use the Network tab of your browser developer tools (eg. Firefox, Chrome") and check the size of the post. Explore the Http request and check the request data sent and what proportion of the time was spent sending the request to the server as opposed to waiting for a server response. That may steer you in the right direction. – Paul Taylor Nov 06 '13 at 15:17
  • @Brian Thanks for the fast reply. Correct me if I'm wrong but I think a wizard will have no impact on the way my data is submitted to the controller. Hiding/showing a part of the contract won't change the data contained in my form. – Nick102 Nov 06 '13 at 15:20
  • Right, since you established volume of data has no impact then it's logical to assume the issue lies somewhere else. That is in the architecture of the application. With many moving parts js, MVC, C# I simply assumed it easier to use an existing working control and shift the data over. Another option would be to run a profiler in order to help identify a bottleneck. – P.Brian.Mackey Nov 06 '13 at 15:32
  • @Paul Thank you for the suggestion. I had tested this but I forgot to mention in my original post. For a given contract I just saved using Google Chrome, 582 Bytes were sent (no letter missing, I really mean less than 1KB). The query took 10.58 seconds to execute. It took 0 ms to send data, there was 10.55 seconds of waiting time and finally 3 ms were spent at receiving the server response. – Nick102 Nov 06 '13 at 15:32
  • What data was sent to the server? I guess the MVC model binder is having problems binding the data you're sending and is throwing lots of exceptions. That may explain the delay and the error messages you're seeing. For example, are you posting arrays containing empty elements that cannot be bound to your models? – Paul Taylor Nov 06 '13 at 15:36
  • @Brian How can I profile what happens between the moment Application_PreRequestHandlerExecute (Global.asax) is called and the moment when my controller's action is called? As I mentionned, I see a lot of "first chance exception" popping in my output console during the "delay" but I've no idea what is happening. – Nick102 Nov 06 '13 at 15:37
  • @PaulTaylor I don't see anything problematic with data sent to the server. It basically contains the information each form presents (header = contract number, name, shipping information, etc // Mandatory items = quantity, price, etc. // ...). Since I use SOME DevExpress components, I see some information specific to those components. However I don't see how this could be the problem since it works fine when the action saves a single section. Can I provide any further details that could help you? – Nick102 Nov 06 '13 at 15:41
  • 2
    You need to narrow the scope of the problem down. It's far too broad to be answerable without knowledge of the entire project posted and reviewed online. – P.Brian.Mackey Nov 06 '13 at 15:43
  • You could post the form data in your question. As MVC is trying to bind the data to the model in this phase of execution, it's likely to be something to do with it IMO. – Paul Taylor Nov 06 '13 at 15:46
  • I suggest using arrays rather than IList collections for your action method arguments. IList may work, but AFAIK, the model binder binds repeated form data elements to arrays. You could also include your viewModel definitions in your post. – Paul Taylor Nov 06 '13 at 16:00
  • @PaulTaylor I edited the OP and added posted data. If you really need models let me know. I you do I think I'll narrow the problem by passing only two parameters (two item lists) to my action. – Nick102 Nov 06 '13 at 16:23
  • @P.Brian.Mackey If the data posted I just added to OP doesn't help I'll make a simpler example and I'll post all information related to the problem. – Nick102 Nov 06 '13 at 16:25
  • If you're seeing 150+ exceptions, as you say, surely that has a lot to do with it. Try saving 2 sections - each with just a single row POSTed - and see what happens. – John H Nov 06 '13 at 16:34
  • Your post data appears to contain ExtraItems and ContractNotes form values. Both of these are bound to the same ViewModel (PreparedConcreteContractNote), but each have different fields in the post data. You need to match up the names of your fields in the view with the corresponding names in the model type, and make sure all values supplied are valid (for example contractNotes[n].Value is null: is PreparedConcreteContractNote.Value a nullable field or a string?). You should find a way to remove all the extraneous data from your post as well. Don't make problems for the model binder. – Paul Taylor Nov 06 '13 at 16:37
  • @PaulTaylor Actually ExtraItems are bound to an item model (PreparedConcreteContractItem) and ContractNotes are bound to a note model (PreparedConcreteContractNote). I think the long similar name created the confusion (let me know if I really made a mistake there). – Nick102 Nov 06 '13 at 16:47
  • @JohnH That is exactly what I started... I've made some progression. Actually I realized that the amount of items HAS an impact on speed. 2 items is extremely fast (very few "first chance exception" too). I still don't know why it slows down, but I see some progress. I'll come back with more details after lunch. – Nick102 Nov 06 '13 at 16:49
  • @Nicolas. Yeah, true. But I also suggested checking the values you're posting are valid (eg. is Value nullable) and removing extraneous data from your post. – Paul Taylor Nov 06 '13 at 17:02
  • I have finally found the solution! See my edited original post for details if you are interested. Thank you all for your precious help! – Nick102 Nov 06 '13 at 18:51

0 Answers0