Hi,
I'm trying to implement the repository pattern using a generic repository like the one found here: Implementing Repository Pattern With Entity Framework
I've created a test suite (I'm using NUnit) to test the repository but I've been having issues. Here's the error I'm getting:
MyBusiness.Test.Domain.RepositoryTest.SelectCol:
System.Data.EntitySqlException : 'ColCoordinate' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near escaped identifier.
I believe it's coming from this method:
public ObjectQuery<E> DoQuery()
{
return _ctx.CreateQuery<E>("[" + typeof(E).Name + "]");
}
I've made sure to add the reference at the top of the page:
using MyBusiness.Domain.DomainModel.EntityFramework;
Here's my test setup and test method:
Repository<ColCoordinate, ObjectContext> _colRepository = null;
ObjectContext _context = null;
EntityContextCreator contextCreator = null;
[SetUp]
public void SetUp()
{
contextCreator = new EntityContextCreator();
_context = contextCreator.Create();
_colRepository = new Repository<ColCoordinate, ObjectContext>(_context);
}
[Test]
public void SelectCol()
{
IList<ColCoordinate> colList = _colRepository.SelectAll();
Assert.True(colList.Count > 0);
}
Anyone know why I'm getting this error or have any suggestions as to how to fix it?
If you need more information please ask and I'll update the question.
Thanks,
Matt