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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With