C
C#3y ago
Alizer

Does DbSet.FirstOrDefaultAsync return a tracked entity?

I have the following code below
var existingCreator = await _dbContext.ContentCreators.FirstOrDefaultAsync(x => x.Name == creator.Name);
var existingCreator = await _dbContext.ContentCreators.FirstOrDefaultAsync(x => x.Name == creator.Name);
is changing properties inside existingCreator going to also change the record inside the sql server?
3 Replies
FroH.LVT
FroH.LVT3y ago
Yes unless you add .AsNoTracking()
Alizer
AlizerOP3y ago
ohhh i see, thats why things were getting weird I KNEW IT
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server