CRUD Page Edit/Delete Issue

Hello Team,
I created a new crud page for the below table on northwind database

CREATE TABLE [dbo].[Trntypes](
	[TrnCode] [nvarchar](4) NOT NULL,
	[SrNo] [int] NOT NULL,
	[Narration] [nvarchar](255) NULL,
 CONSTRAINT [PK_TrnTypes] PRIMARY KEY CLUSTERED 
(
	[TrnCode] ASC,
	[SrNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

The view,add pages work fine but the update /delete pages gives error below


I tried to debug the code and found that api controller is being not hit. Could you pls guide how this error can be resolved.
Thanks !

I was able to reproduce the problem and as far as I can see OData path with composite keys where one of the keys is string cannot be found. The same works normally for example with Northwind OrderDetails where the composite key is from two integer fields. I'll continue to research the problem and I'll post here when I have more info.

UPDATE: The issue is related to .NET6/OData 8.x, the same works normally with .NET5/OData 7.x!

@enchev Thanks for the response. Can it be fixed? or is there any work around ? Kindly advise

All I know so far is in my previous reply.

The issue was caused by a breaking change introduced by Microsoft in OData 8.x compared to OData 7.x:

The only way to enable this in OData 8x. is to fully qualify the route:

[HttpGet("/odata/TestDB/Trntypes(TrnCode={keyTrnCode},SrNo={keySrNo})")]
...

We will do our best to include fix for this in our next update later this week.

1 Like

Thank you :heart: Will work in net 5 till then :slight_smile:

Checked using the latest update. The Issue with key of string+integer is resolved. Still there is another table with date+integer key for that the error persists

CREATE TABLE [dbo].[DayBegin](
	[LocID] [int] NOT NULL,
	[CurrDate] [datetime] NOT NULL,
	[DayEnd] [bit] NULL,
	[DateLock] [bit] NULL,
	[Holiday] [bit] NULL,
 CONSTRAINT [PK_DayBegin] PRIMARY KEY CLUSTERED 
(
	[LocID] ASC,
	[CurrDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

It gives below error


I tried to debug the Odata controller and found that it is not being hit. Can you please check this also.

Most probably the issue is related to the DateTime keys in general - never seen such before. I’ll review what code is generated and I’ll post here when I have more info.

I was able to fix the issue and the fix will be included in our next update early next week.

1 Like

Excellent! Thanks for the prompt response :slight_smile: