1

My problem is that UserStore requires IMongoCollection to initiate but MongoDb's C# driver's GetCollection Method returns MongoCollection

 public class UserService : IUserService
{
    private IRepository<WspUser> _wspUserRep;
    public UserService(IRepository<WspUser> wspUserRep)
    {
        _wspUserRep = wspUserRep;
    }
    public void CreateUser(WspUser wspUser)
    {
        var userCol = _wspUserRep.GetAll();
        var userStore = new UserStore<WspUser>(userCol);//Error Cannot convert MongoColleciton<WspUser> into IMongoCollection<WspUser>
        userStore.CreateAsync(wspUser);
    }
}

further more MongoCollection doesn't implements IMongoCollection

how to fix this kindly help

Raas Masood
  • 1,475
  • 3
  • 23
  • 61

0 Answers0