Assuming that thedbcontext
is a valid DbContext
from EntityFramework, then all you need to do is the following
var usernameToFind = "user1";
var db = new mycontext();
var logonCount = db.application_users.Count(t => t.username == usernameToFind);
Typically your mycontext
class would derive directly from EF's DbContext
class like so
public partial class mycontext : DbContext
{
public virtual DbSet<application_users> application_users { get; set; }
}