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();
@hyobokkim16223 жыл бұрын
I did a lot of searching to find this information, but I could only find it here. Thank you very much.
@peadarfitzpatrick32874 жыл бұрын
Excellent course. Thanks for the effort you put into you content. Really appreciated!
@stefangabor59853 жыл бұрын
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.
@talkathiriify4 жыл бұрын
Excellent as usual. Thank you very much.
@MrKaviraj754 жыл бұрын
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();_*
@Rajeshsingh-ws5th4 жыл бұрын
Xamarin Next please! (supporting Chandan)
@BCLBlazorCollectionsLibrary4 жыл бұрын
I am also waiting for it :)
@furiouspaladin92823 жыл бұрын
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.
@doorscomputersco.57134 жыл бұрын
May I kindly request a tutorial on How to Save data into Two or more Tables in Blazor? Thanks!
@reflextm21574 жыл бұрын
Did he do a video on that ?
@cristians29764 жыл бұрын
If we modified the employee class, there is no need to do an add-migration and update-database?
@amirhosseinahmadi37064 жыл бұрын
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.
@louisecrowe49683 жыл бұрын
Fantastic explanation - thanks!
@reinhardheydrich3142 жыл бұрын
thank you so much sir, i appreciate your help thank you so much
@flaviusioan694 жыл бұрын
clear...very good tutorials
@rajneshp3 жыл бұрын
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.
@imadabab4 жыл бұрын
Excellent. Thanks a lot.
@bolbittu4 жыл бұрын
Amazing!
@conaxlearn85663 жыл бұрын
5:42 Blazor renders the page once before Department is not yet available, and then renders the page again when the Department becomes available?
@Rizzwan74 жыл бұрын
Nice Explaination.
@roadtripping Жыл бұрын
How is .Include working? Where is an Employee's "Department" property set?
@coolwaterdvr4 жыл бұрын
Thank you Venkat. 🙏
@dejanradojevic32974 жыл бұрын
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?
@TihomirJovanovic19693 жыл бұрын
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).
@darkogele4 жыл бұрын
Hello Venkat, do you have the code on Git hub?
@cudid3 жыл бұрын
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?
@Desperate4Freedom.10 ай бұрын
gold
@conaxlearn85664 жыл бұрын
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.
@bolbittu4 жыл бұрын
Xamarin Next please!
@AhmetYigiter4 жыл бұрын
Chandan Mandal absolutely!
@BarriDuty4 жыл бұрын
yeah it would be very interesting blazor components on xamarin forms
@ashutoshsrivastava22754 жыл бұрын
CQRS + MediatR next please
@BCLBlazorCollectionsLibrary4 жыл бұрын
Already have that tut in my channel, hope will help :)
@fredrichvilaga99313 жыл бұрын
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
@ivanb86624 жыл бұрын
I found typo also DateOfBrith -> DateOfBirth need to update table in MySQL. How it to do without removing?
@DanceManAlex3 жыл бұрын
youd make the change and then do another migration. in the nuget console type : "add-migration dateOfBirthCorrection" and then "update-database"
@izwansystec872 жыл бұрын
i have issues when set Department Name... :-(
@hikayat_stories4 жыл бұрын
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_stories4 жыл бұрын
read this to see the solving of the error: github.com/dotnet/efcore/issues/3312