Cache feature for MongoRepository
You don't need to create a model, but if you are doing so you need to extend Entity
//if you are able to define your model
public class User : Entity
{
public string Username { get; set; }
public string Password { get; set; }
}
There are multiple base constructors, read summaries of others
public class UserRepository : CachedRepository<User>
{
public UserRepository(string connectionString) : base(connectionString) {}
//custom method
public User FindbyUsername(string username)
{
return First(i => i.Username == username);
}
//custom method2
public void UpdatePassword(User item, string newPassword)
{
repo.Update(item, i => i.Password, newPassword);
}
}