Sequence contains no matching element - EntityFramework

c# ef-code-first entity-framework wcf wcf-data-services

Question

I'm using EF 6.1.0 and was creating a WCF Service.

First I created a Class Library containing my entities, Mappers and Context for initializing EF. I've also created a class containing an instantiation of the context and have this code:

public IQueryable<[Entity]> GetAll()
{
    return context.[Entity].AsQueryable();
}

On the otherhand, I've created a WCF Service on the same project and Calls the function GetAll() in the.svc file like this:

public List<[Entity]> GetList()
{
    [iObject] repository = new [Object](new Context());
    return repository.GetAll().ToList();
}

The project is building. I even check the cconfiguration and it is in the right DB. However, database and tables which is supposedly created doesn't exist and an error "Sequence contains no matching element" shows up in the return.

If this one is confusing can you point me some link of WCF Services using Code First Entity Framework.

1
22
4/10/2014 8:38:45 AM

Popular Answer

I had a bug where I got a System.InvalidOperationException with the message Sequence contains no matching element because I had an incorrect string value being passed to .HasColumnType() in my table configuration.

62
10/2/2014 8:15:36 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow