Created
          August 18, 2022 02:48 
        
      - 
      
- 
        Save ianChen806/9c8413a00e507566f8ebace49ff6aae8 to your computer and use it in GitHub Desktop. 
    ef update without select
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // ef | |
| [Fact] | |
| public async Task Test() | |
| { | |
| var agent = new Agent() | |
| { | |
| Id = 9, | |
| Name = "new2" | |
| }; | |
| _db.Agents.Attach(agent); | |
| _db.Entry(agent).Property(r => r.Name).IsModified = true; | |
| _db.SaveChanges(); | |
| } | |
| // ef core | |
| [Fact] | |
| public async Task Test() | |
| { | |
| var agent = new Agent() | |
| { | |
| Id = 9, | |
| Name = "new2" | |
| }; | |
| _db.Entry(agent).Property(r => r.Name).IsModified = true; | |
| _db.SaveChanges(); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment