Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Blazor WASM Hosted App with OData Server API - I started a thread with the OData package repo (see link below), but it is looking like this is an issue with how the Grid/DataManager for ODataV4 is configured. On a PATCH update against a grid with related data using Default or Dialog Edit Modes, it is including empty related data, which per OData would be treated as a new record as it should, thus causing the operation to fail (400/500 server error):
Request/Response/Data Model
Request: /odata/AssetsOdata(1)
Payload (from Edge Dev Console):
{
"AssetID": 1,
"Name": "Larger Tank 100",
"AssetTypeID": 1,
"Facility": {},
"AssetType": {}
}
Data Model
Asset: AssetID, Name, AssetTypeID, FacilityID
AssetType: AssetTypeID, AssetID, IDSTypeID
Facility: FacilityID, Name, LAT, LON
Error:
Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (12ms) [Parameters=[@p0='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
SET NOCOUNT ON;
INSERT INTO [AssetTypes] ([Name])
VALUES (@p0);
SELECT [AssetTypeID], [PeriodEnd], [PeriodStart]
FROM [AssetTypes]
WHERE @@rowcount = 1 AND [AssetTypeID] = scope_identity();
fail: Microsoft.EntityFrameworkCore.Update[10000]
An exception occurred in the database while saving changes for context type '.Server.Data.Context'.
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
---> Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'Name', table '.dbo.AssetTypes'; column does not allow nulls. INSERT fails.
I don't need the grid to pass on the related object types, especially if its null. Is there an easy way to remove null related data before the request is submitted? I have one grid with related data not impacted, but that's because it uses your external form control model, not Default or Dialog, so the arguments passed are explicitly the fields needed. I shouldn't have to rewire every grid like that.