Exception after extending orders
I've extended PurchaseOrder with a money/decimal field, OrdersForm with a money/decimal field, and LineItem with a money/decimal and a string field. After generating the dll, and running OrderMapping.exe against my web.config with success, and updating the SQL db, I'm getting the following error message:
Server Error in '/StarterSite' Application.
Unable to cast object of type 'System.DBNull' to type 'System.String'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details:System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:[InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.] Microsoft.CommerceServer.Runtime.Orders.OrderContext.ValidateXmlFileWithSql(SchemaMapping mapping, String connStr, Int32 timeout) +1236 Microsoft.CommerceServer.Runtime.Orders.OrderContext.CreateSchemaAndPipelineMapping(SchemaMapping& schemaMapping, PipelineAdapter& pipelineAdapter, String appRootPath, CommerceOrdersConfiguration ordersConfiguration) +259 Microsoft.CommerceServer.Runtime.Orders.OrderContext.Initialize(String transactionResourceConnectionString, String transactionConfigResourceConnectionString) +212 |
There is no other info in the event log, is there anywhere else I can look to see what causing this?
TIA, emergency help GREATLY appreciated
gene
Things cleared up, but now I get this error:
Source Error:
Line 428: pipeline.Profiles.Add(pair.Key, pair.Value); Line 429: } Line 430: } Line 431: return basket.RunPipeline(pipeline); Line 432: } |
Source File: C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs
Line: 430
Stack Trace:
[TargetException: Object does not match target type.] System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target) +2284281 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +114 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +55 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +18 Microsoft.CommerceServer.Internal.Orders.Storage.PropertyMemberAccess.Get(Object o) +15 Microsoft.CommerceServer.Internal.Orders.Storage.PropertyMemberAccess.RawGet(Object o) +4 Microsoft.CommerceServer.Runtime.Orders.PipelineAdapter.PopulateDictionary(IDictionary dict, Hashtable propertyMap, ClassInfo classInfo, ClassInfo orderGroupClassInfo, Object sourceObject, OrderForm orderForm, MappingResults results) +284 Microsoft.CommerceServer.Runtime.Orders.PipelineAdapter.WriteDictionary(OrderForm orderForm, IDictionary dict) +160 Microsoft.CommerceServer.Runtime.Orders.PipelineAdapter.WriteDictionary(OrderForm orderForm) +170 Microsoft.CommerceServer.Runtime.Orders.OrderGroup.RunPipeline(PipelineInfo pipelineInfo, PipelineBase pipeline, ITransaction trans) +316 Microsoft.CommerceServer.Runtime.Orders.OrderGroup.RunPipeline(PipelineInfo pipelineInfo, ITransaction trans) +144 Microsoft.CommerceServer.Runtime.Orders.OrderGroup.RunPipeline(PipelineInfo pipelineInfo) +6 CommerceComponents.Helpers.BasketHelper.RunPipeline(String pipelineName, OrderPipelineType type) in C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs:430 CommerceComponents.Helpers.BasketHelper.RunBasketPipeline(String pipelineName) in C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs:322 CommerceComponents.Helpers.BasketHelper.RunBasketPipeline() in C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs:308 CommerceSite.BasketPage.OnPreRender(EventArgs e) in c:\Inetpub\wwwroot\StarterSite\App_Code\BasketPage.cs:155 Cart.OnPreRender(EventArgs e) in c:\Inetpub\wwwroot\StarterSite\Cart.aspx.cs:43 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360 |
Are there other steps to take to make the checkout process work now with these order extensions? Like cast an OrderForm to the new OrderForm?
TIA
gene
Did you modify the OrderObjectMappings.xml file?
-Max
Yes, thanks. I've also modified in OrdersWebService, and have finally been able to open the Orders UI. But, I'm getting this message when I try to open a PO in the UI: (The UI does show my extended field, Yes!)
Event Type: Error
Event Source: Commerce Server Web Services
Event Category: None
Event ID: 4
Date: 8/30/2007
Description:
An exception occurred in the 'OrdersWebService' Web service. Exception details follow:
Microsoft.CommerceServer.Runtime.Orders.MappedClassDataMismatchException: Table LineItems contains 29 columns, expected 30 columns according to mapping definition
at Microsoft.CommerceServer.Runtime.Orders.POLoader.LoadFromDataSetHelper(DataSet dataSet, ClassInfo[] dependencyClassList, Int32 depClassListLen, Hashtable[] depInstanceLookup, BinaryFormatter formatter, String filter)
at Microsoft.CommerceServer.Runtime.Orders.POLoader.LoadFromDataSet(DataSet dataSet, OrderGroupCollection ogColl)
at Microsoft.CommerceServer.Runtime.Orders.POLoader.LoadSearchSet(Guid searchSetId, OrderGroupCollection ogc)
at Microsoft.CommerceServer.Runtime.Orders.POLoader.Load(String storedProcName, ListDictionary sqlParameters)
at Microsoft.CommerceServer.Orders.DataManagement.ServerOrderSystem.LoadPurchaseOrderFromDB(Guid orderGroupId)
at Microsoft.CommerceServer.Orders.DataManagement.ServerOrderSystem.GetPurchaseOrderAsDataSet(Guid orderGroupId)
at Microsoft.CommerceServer.Orders.WebService.OrdersWebService.GetPurchaseOrderAsDataSet(Guid orderGroupId)
The mapping actually has 31 columns, so I'm not sure whats up here.
Thanks for looking at this
gene
What ever changes you did on the runtime site needs to happen in the WebService. This means that you need to copy your dlls into the bin of Web Service and modify the web.config and move your xml config files to the Web Service.
Good luck,
-Max
Something was out of sync, I reran the sql script against the database, and now the Orders management UI works like a charm, all the new properties are there.
I'm still getting the same exception on the web though, anytime I try to add a product to the cart, it bombs trying to run the basket pipeline now.
Will the checkout process as it is run with the lineitem, orderform, and purchaseorder all being extended?
thanks,
gene
the exception again:
[TargetException: Object does not match target type.]
System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target) +2284281
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +114
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +55
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +18
Microsoft.CommerceServer.Internal.Orders.Storage.PropertyMemberAccess.Get(Object o) +15
Microsoft.CommerceServer.Internal.Orders.Storage.PropertyMemberAccess.RawGet(Object o) +4
Microsoft.CommerceServer.Runtime.Orders.PipelineAdapter.PopulateDictionary(IDictionary dict, Hashtable propertyMap, ClassInfo classInfo, ClassInfo orderGroupClassInfo, Object sourceObject, OrderForm orderForm, MappingResults results) +284
Microsoft.CommerceServer.Runtime.Orders.PipelineAdapter.WriteDictionary(OrderForm orderForm, IDictionary dict) +160
Microsoft.CommerceServer.Runtime.Orders.PipelineAdapter.WriteDictionary(OrderForm orderForm) +170
Microsoft.CommerceServer.Runtime.Orders.OrderGroup.RunPipeline(PipelineInfo pipelineInfo, PipelineBase pipeline, ITransaction trans) +316
Microsoft.CommerceServer.Runtime.Orders.OrderGroup.RunPipeline(PipelineInfo pipelineInfo, ITransaction trans) +144
Microsoft.CommerceServer.Runtime.Orders.OrderGroup.RunPipeline(PipelineInfo pipelineInfo) +6
CommerceComponents.Helpers.BasketHelper.RunPipeline(String pipelineName, OrderPipelineType type) in C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs:430
CommerceComponents.Helpers.BasketHelper.RunBasketPipeline(String pipelineName) in C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs:322
CommerceComponents.Helpers.BasketHelper.RunBasketPipeline() in C:\commerceserver\CommerceComponentsSource\ControlLibrary\Helpers\BasketHelper.cs:308
CommerceSite.BasketPage.OnPreRender(EventArgs e) in c:\Inetpub\wwwroot\StarterSite\App_Code\BasketPage.cs:155
Cart.OnPreRender(EventArgs e) in c:\Inetpub\wwwroot\StarterSite\Cart.aspx.cs:43
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Anytime you make changes make sure to restart the app domain or do an iisreset. Hope this helps.