AI OnAI Off
Apparently, and not documented, the ContactInformation property is required. So, I provided this, and the following exception now occurs:
The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
The data for table-valued parameter "@Warehouse" doesn't conform to the table type of the parameter.
The statement has been terminated.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.Data.SqlClient.SqlException: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
The data for table-valued parameter "@Warehouse" doesn't conform to the table type of the parameter.
The statement has been terminated.
Must be a bug or the result of an EPiServer upgrade?
You need to provide both created date and modified date when you create Warehouses programatically.
var warehouse = new Warehouse() { ApplicationId = AppContext.Current.ApplicationId, ContactInformation = new WarehouseContactInformation(), Code = "UniqueCode", SortOrder = warehouseRepository.List().Count(), Created = DateTime.Now, Modified = DateTime.Now, Name = "Name" //IsActive = true, //IsPrimary = true, //IsFulfillmentCenter = true, //IsPickupLocation = true, //IsDeliveryLocation = true }; warehouseRepository.Save(warehouse);
Thanks for the solution.
Has still not been fixed in the latest version. The documentation should be updated atleast.
Kind Regards
Sandeep
Hello
I'm trying to create a warehouse using:
However, all I'm getting is a NullReferenceException coming from the Mediachase-dll. What could be wrong? Is this a bug?
As a side note: what is the ApplicationId-field used for in this context?
Thanks!
-Emil (new to EPiServer)
(The same happens when using the example SaveWarehouse() taken from: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Commerce/75/Warehouses-and-inventories/Warehouses-and-inventories-examples/)