SqlException: Invalid object name "User"

Viewed 31

Hi im getting this error where it says "SqlException: Invalid object name 'User'. even though i have build the application without errors and checked the application everything except this works, please do give me some suggetsions.

code:

 public async Task<User> Create(User user)
        {
            _context.User.Add(user);
            await _context.SaveChangesAsync();//error happens here
            return user;
        }
1 Answers

Change _context.User.Add(user); to _context.Users.Add(user);

Related