title: Why doesn't Entity Framework recognise an existing record in the database?
body: <p>I have created a database system for a library, and when a user registers the program checks if they already have an account, but this is always returning false even when I can see in my DBMS that the record exists.</p>
  <pre><code> public static bool UserExists(string email)
   {
              using (var context = new LibraryDbContext())
              {
                  if (context.Users.Any(d =&gt; d.Email == email))
                  {
                      return true;
                  }
                  else
                  {
                      return false;
                  }
              }
   }
  </code></pre>
  <p>Also, this is my Dbcontext class</p>
  <pre><code>public class LibraryDbContext : DbContext
  {
      public LibraryDbContext()
          : base()
      {
      }
  
      public DbSet&lt;Book&gt; Books { get; set; }
  
      public DbSet&lt;User&gt; Users { get; set; }
  
      public DbSet&lt;ReturnsLog&gt; Returns { get; set; }
  
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          optionsBuilder.UseInMemoryDatabase(&quot;LibraryProjectDbo&quot;);
      }
  }
  </code></pre>