vileruby
vileruby
CC#
Created by vileruby on 9/11/2023 in #help
❔ Repository pattern
ok thanks for the help
21 replies
CC#
Created by vileruby on 9/11/2023 in #help
❔ Repository pattern
Excuse the typo...
21 replies
CC#
Created by vileruby on 9/11/2023 in #help
❔ Repository pattern
so in the following example does look correct to you, in the scenario where you are trying to save 2 entities in one go? private DbContext _context; public void SaveStudentInfo(Student student, Attendance attendence) { _context.student.ExecuteUpdateAsync(); _context.attendance.ExecureUpdateAsync(); } This is just an example off the top of my head, for learning purposes
21 replies
CC#
Created by vileruby on 9/11/2023 in #help
❔ Repository pattern
I see
21 replies
CC#
Created by vileruby on 9/11/2023 in #help
❔ Repository pattern
I thought that there was a way to save every entity being tracked by the dbcontext in one method call? or do you have to call .ExecuteUpdateAsync on every entity?
21 replies
CC#
Created by vileruby on 9/11/2023 in #help
❔ Repository pattern
So generally you'd prefer the service class to have the DbContext injected directly? And you would call .Entry on the dbcontext for each entity to update in the method?
21 replies