Display data from two or more related tables in Blazor

preview_player
Показать описание
How to retrieve data from two or more related database tables and display them in a Blazor web application.

Text Article and Slides

Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.

Blazor tutorial for beginners

Blazor Blog

Angular, JavaScript, jQuery, Dot Net & SQL Playlists

Let's gift education together
Рекомендации по теме
Комментарии
Автор

I did a lot of searching to find this information, but I could only find it here. Thank you very much.

hyobokkim
Автор

Hi venkat, Correct me if I'm wrong but we can't use "ThenInclude" at the same level. If you want to load another navigation property on objects (same level) then use another "Include" method e.g in your case:
return await appDbContext.Employees
.Include(e => e.Department)
.Include(e => e.Skill)
.FirstOrDefaultAsync(e => e.EmployeeId == employeeId);
we only use "ThenInclude" if there is a need for multiple levels of depth. As it says "Specifies additional related data to be further included based on a related type that was just included".
e.g: var blogs = context.Blogs
.Include(blog => blog.Posts)
.ThenInclude(post => post.Author)
.ThenInclude(author => author.Photo)
.ToList();

aribyousuf
Автор

Excellent course. Thanks for the effort you put into you content. Really appreciated!

peadarfitzpatrick
Автор

To avoid the empty card at 6:03, it's better to remove the default value that you have set for the Employee object in the last video since we have the null check now.
i.e.
_public Employee employee { get; set; } _*_= new Employee();_*

MrKaviraj
Автор

Excellent as usual.
Thank you very much.

talkathiriify
Автор

Xamarin Next please! (supporting Chandan)

Rajeshsingh-wsth
Автор

Always great content as usual, :)
I have a little remarque, when you deal with navigations, and you have a long list of entities it is always better to have some sort of container or manager that handles the abstractions of all the includes. Less messy code.

stefangabor
Автор

5:42 Blazor renders the page once before Department is not yet available, and then renders the page again when the Department becomes available?

conaxlearn
Автор

If we modified the employee class, there is no need to do an add-migration and update-database?

cristians
Автор

thank you so much sir, i appreciate your help thank you so much

reinhardheydrich
Автор

May I kindly request a tutorial on How to Save data into Two or more Tables in Blazor? Thanks!

doorscomputersco.
Автор

This course has been very helpful. However, I think you should have a separate one for the EF part, since this is a blazor tutorial.
I am using an unrelated NoSql database, for example, and find most EF related stuff irrelevant.

furiouspaladin
Автор

Hello Venkat, do you have the code on Git hub?

darkogele
Автор

Hi.
Nice videos and they're very helpful.
I had a question - if we add another table to the video example -> User (UserID, Username, Email). Now if we want to add three attributes (CreatedBy, ModifiedBy, DeletedBy) to both the Employee and Department tables. Can you please explain how we can capture UserID in the three attributes in terms of class implementation for both Employee and Department classes.

rajneshp
Автор

How is .Include working? Where is an Employee's "Department" property set?

roadtripping
Автор

Hi, when we add public Deparment Deparment {get;set;} navigation property how to avoid next add-migration to not store that property on database table?

dejanradojevic
Автор

i try to display the department name in the employee list. but receive render error . i guest it not possible... my ojective is to make a table/grid list that display both employee table and it related deparment data. is this actually possible?

cudid
Автор

When I add Navigation Property in Employee class get error "HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error)". Any suggestions? Without Navigation Property all works fine (except I didn’t chain Include method).

TihomirJovanovic
Автор

Hi I am getting the error below:

System.NullReferenceException
Hresult=0x80004003
Message=Object reference not set to an instance of an object
Source=Telerik.Blazor

fredrichvilaga
Автор

I found typo also DateOfBrith -> DateOfBirth need to update table in MySQL. How it to do without removing?

ivanb