question

sblb-6958 avatar image
0 Votes"
sblb-6958 asked sblb-6958 edited

foreign key one-to-may doesn't working in blazor wasm net. ore6

Hi, I try to implement the Foreign Key in my app to link several actions,class model ActionItem with main table Developer.
When I run app the ActionItem is null.
Have you some advise ?

you can find github link AppWebFK


When run my app I have the output below. As you can see the ActionItem is well link to Developer via DeveloperId key.

 Microsoft.EntityFrameworkCore.Infrastructure: Information: Entity Framework Core 6.0.10 initialized 'ApplicationDBContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer:6.0.10' with options: None
 Microsoft.EntityFrameworkCore.Database.Command: Information: Executed DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    
 SELECT [d].[DeveloperId], [d].[ECR], [d].[FEE], [a].[ActionId], [a].[CloseDate], [a].[DescriptionA], [a].[DeveloperId], [a].[OpenDate], [a].[PlanDate], [a].[State], [a].[Tilte]
    
 FROM [Developers] AS [d]
 LEFT JOIN [ActionItems] AS [a] ON [d].[DeveloperId] = [a].[DeveloperId]
 ORDER BY [d].[DeveloperId]


dotnet-aspnet-core-blazordotnet-entity-framework-core
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@sblb-6958,

The GitHub link is broken now, please share your model class, Fluent API and relevant query code here. In addition, please try eager loading in your query code and check if it works for you. for more information, please refer to: Eager Loading of Related Data

Best regards,
Zhanglong


0 Votes 0 ·
sblb-6958 avatar image sblb-6958 ZhanglongWu-MSFT ·

Hi, sorry for the late answer.
I activate the github link. So you can find class model and Fluent API; AppWebFK
I currently i still have a problem to integrate FK. could please help me on it?


0 Votes 0 ·

0 Answers