public T Get(object id) { // T entityTmp; // throw new NotImplementedException(); /* * // Todo find a btter way to find the elements LINQ * foreach(T entity in _dataSet) * { * // entity. * } * return entityTmp; */ // return _dataSet.Find(e => e.Id == id); // is not going to work. There is no guarantee you will find it by Id // you are not sure there is such property Id // return _dataSet.FindAll() // In this case we have 2 variants we can force all models to have Id property, but this still // doesn't fix the problem, because the problem with the syn between the DB and in memory remains // So I am forced again to use the Data Mapper directly // I have DB where the Primary Keys are not called Id return(_dataMapper.Get(id)); }
public T Get(object id) // each object should have a property Id { // The models should implement the same interface IId I have to make sure all entities have Id // throw new NotImplementedException(); return(_dataMapper.Get(id)); }