Display data from two or more related tables in Blazor

  Рет қаралды 37,771

kudvenkat

kudvenkat

Күн бұрын

Пікірлер: 46
@hyobokkim1622
@hyobokkim1622 3 жыл бұрын
I did a lot of searching to find this information, but I could only find it here. Thank you very much.
@peadarfitzpatrick3287
@peadarfitzpatrick3287 4 жыл бұрын
Excellent course. Thanks for the effort you put into you content. Really appreciated!
@aribyousuf
@aribyousuf 4 жыл бұрын
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();
@talkathiriify
@talkathiriify 4 жыл бұрын
Excellent as usual. Thank you very much.
@Rajeshsingh-ws5th
@Rajeshsingh-ws5th 4 жыл бұрын
Xamarin Next please! (supporting Chandan)
@BCLBlazorCollectionsLibrary
@BCLBlazorCollectionsLibrary 4 жыл бұрын
I am also waiting for it :)
@stefangabor5985
@stefangabor5985 3 жыл бұрын
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.
@MrKaviraj75
@MrKaviraj75 4 жыл бұрын
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();_*
@reinhardheydrich314
@reinhardheydrich314 2 жыл бұрын
thank you so much sir, i appreciate your help thank you so much
@louisecrowe4968
@louisecrowe4968 3 жыл бұрын
Fantastic explanation - thanks!
@flaviusioan69
@flaviusioan69 4 жыл бұрын
clear...very good tutorials
@imadabab
@imadabab 3 жыл бұрын
Excellent. Thanks a lot.
@bolbittu
@bolbittu 4 жыл бұрын
Amazing!
@cristians2976
@cristians2976 4 жыл бұрын
If we modified the employee class, there is no need to do an add-migration and update-database?
@amirhosseinahmadi3706
@amirhosseinahmadi3706 4 жыл бұрын
Well, not in this particular case, because by adding the navigation property "public Department Department { get; set; }" you're not actually making any changes to the database schema. Navigation properties are special to your C# model classes.
@Rizzwan7
@Rizzwan7 4 жыл бұрын
Nice Explaination.
@doorscomputersco.5713
@doorscomputersco.5713 4 жыл бұрын
May I kindly request a tutorial on How to Save data into Two or more Tables in Blazor? Thanks!
@reflextm2157
@reflextm2157 3 жыл бұрын
Did he do a video on that ?
@bolbittu
@bolbittu 4 жыл бұрын
Xamarin Next please!
@AhmetYigiter
@AhmetYigiter 4 жыл бұрын
Chandan Mandal absolutely!
@BarriDuty
@BarriDuty 4 жыл бұрын
yeah it would be very interesting blazor components on xamarin forms
@coolwaterdvr
@coolwaterdvr 4 жыл бұрын
Thank you Venkat. 🙏
@furiouspaladin9282
@furiouspaladin9282 3 жыл бұрын
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.
@conaxlearn8566
@conaxlearn8566 3 жыл бұрын
5:42 Blazor renders the page once before Department is not yet available, and then renders the page again when the Department becomes available?
@roadtripping
@roadtripping Жыл бұрын
How is .Include working? Where is an Employee's "Department" property set?
@ashutoshsrivastava2275
@ashutoshsrivastava2275 4 жыл бұрын
CQRS + MediatR next please
@BCLBlazorCollectionsLibrary
@BCLBlazorCollectionsLibrary 4 жыл бұрын
Already have that tut in my channel, hope will help :)
@Desperate4Freedom.
@Desperate4Freedom. 9 ай бұрын
gold
@cudid
@cudid 3 жыл бұрын
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?
@TihomirJovanovic1969
@TihomirJovanovic1969 3 жыл бұрын
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).
@rajneshp
@rajneshp 3 жыл бұрын
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.
@fredrichvilaga9931
@fredrichvilaga9931 3 жыл бұрын
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
@dejanradojevic3297
@dejanradojevic3297 4 жыл бұрын
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?
@ivanb8662
@ivanb8662 3 жыл бұрын
I found typo also DateOfBrith -> DateOfBirth need to update table in MySQL. How it to do without removing?
@DanceManAlex
@DanceManAlex 3 жыл бұрын
youd make the change and then do another migration. in the nuget console type : "add-migration dateOfBirthCorrection" and then "update-database"
@darkogele
@darkogele 4 жыл бұрын
Hello Venkat, do you have the code on Git hub?
@conaxlearn8566
@conaxlearn8566 4 жыл бұрын
Some people asked about Add-Migration after adding Department property to the Employee class, so I did a test. I created a Test class like this: public class Test { public int TestId { get; set; } // This is required for primary key. Without it Add-Migration will fail public Employee Employee { get; set; } public Department Department { get; set; } } Then in AppDbContext.cs added this line: public DbSet Tests { get; set; } Then ran Add-Migration and Update-Database, the resulting Test table had this structure: CREATE TABLE [dbo].[Tests] ( [TestId] INT IDENTITY (1, 1) NOT NULL, [EmployeeId] INT NULL, [DepartmentId] INT NULL, CONSTRAINT [PK_Tests] PRIMARY KEY CLUSTERED ([TestId] ASC), CONSTRAINT [FK_Tests_Departments_DepartmentId] FOREIGN KEY ([DepartmentId]) REFERENCES [dbo].[Departments] ([DepartmentId]), CONSTRAINT [FK_Tests_Employees_EmployeeId] FOREIGN KEY ([EmployeeId]) REFERENCES [dbo].[Employees] ([EmployeeId]) ); GO CREATE NONCLUSTERED INDEX [IX_Tests_DepartmentId] ON [dbo].[Tests]([DepartmentId] ASC); GO CREATE NONCLUSTERED INDEX [IX_Tests_EmployeeId] ON [dbo].[Tests]([EmployeeId] ASC); So, for complex data type properties, EF Core takes only the Id fields from them to be added to the target table. Having said that, maybe this is just the default behaviour and can be changed by some configuration.
@izwansystec87
@izwansystec87 2 жыл бұрын
i have issues when set Department Name... :-(
@ivanb8662
@ivanb8662 3 жыл бұрын
Employee == null || Employee.Department == null -> Employee?.Department == null
@hikayat_stories
@hikayat_stories 4 жыл бұрын
Please can someone answer me. I have in the class employee a navigation property : ICollection, and when I tried to loop in the razor component to get the detail of location class I get a null object.
@hikayat_stories
@hikayat_stories 4 жыл бұрын
read this to see the solving of the error: github.com/dotnet/efcore/issues/3312
Blazor event handling
8:11
kudvenkat
Рет қаралды 30 М.
Blazor data binding
8:15
kudvenkat
Рет қаралды 33 М.
POV: Your kids ask to play the claw machine
00:20
Hungry FAM
Рет қаралды 14 МЛН
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 181 М.
Uploading Files to Blazor - The Blazor File Upload Mini Course
43:11
New Blazor WebAssembly capabilities in .NET 6
29:11
dotnet
Рет қаралды 98 М.
.NET 7 Blazor DataGrid 🔥 Made by the Blazor Team (QuickGrid)
13:49
Binding select element with database data in Blazor
9:33
kudvenkat
Рет қаралды 36 М.
Blazor route parameters
10:21
kudvenkat
Рет қаралды 37 М.
Blazor Server Side CRUD Application Tutorial using ASP.NET CORE
36:23
SIMPLEST Blazor Authentication And Authorization Tutorial
23:44
Just Blazor Programming
Рет қаралды 18 М.