I read several tutorials with framework 6 entity ...
The basics are simple.
using (var context = new MyContext()) { User u = context.Users.Find(1); }
But how to use โWhereโ or something else in โDbSetโ with users?
public class MyContext : DbContext { public MyContext() : base("name=MyContext") {
Users
[Table("User")] public class User : Base { public Guid Id { get; set; } [StringLength(100)] public string Username { get; set; } }
And this is a problem that does not work.
string username = "Test"; using (var context = new MyContext()) { User u = from user in context.Users where user.Username == username select user; }
Error: There was no request template implementation for the source type DbSet. "Where" not found. Maybe the link or use of the directive for "System.Link" is missing.
If I try to autocomplete methods, they are not.

Why does this not work ?: (
// Edit: Adding System.Linq to the beginning of the file changes the function of the problem above, so I no longer have the problem.
But why where is wrong now?
The type "System.Linq.IQueryable<User>" cant converted into "User" explicit. There already exists an explicit conversion. (Possibly a cast is missing)

source share