0

basically I'm getting an exception while im performing this:

var userDb = new UserData();
userDb.InsertData(DbName);

My InsertData function:

var userRepo = new UserRepository();
var users = new List<User>();
using (var db = userRepo.InitialDb(dbName))
{
    userRepo.AddList(_users);

    users = userRepo.GetAll();
}

and while I'm running InsertData function, i get this exception:

{"Method not found: 'LiteDB.LiteDatabase Db.Data.Repository.Repository`1.InitialDb(System.String)'."}

My UserRepository.cs

public class UserRepository : Repository<User>{}

While my Repository.cs:

public abstract class Repository<T> where T : class
{
  protected LiteDatabase db;

  public LiteDatabase InitialDb(string dbPath)
  {
      db = new LiteDatabase(dbPath);
      return db;
  }
}

So the question here is,

1. I don't know if i inherited my parent well.

2. If yes, why there is a method not found exception thrown?

Thanks in advance, let me know if i missed out anything in the question.

Win
  • 61,100
  • 13
  • 102
  • 181
Qiang
  • 3
  • 1
  • Can be a problem with LiteDB versions. Take a look here: https://stackoverflow.com/questions/7578583/method-not-found-on-runtime and here https://stackoverflow.com/questions/8058832/system-missingmethodexception-method-not-found – mbdavid Aug 09 '17 at 22:03
  • Thanks! It is exactly caused by the version of LiteDb, thank you. – Qiang Aug 10 '17 at 01:09

0 Answers0