Tag Archives: Entity Framework

Enity Framework “column in table is of a type that is invalid for use as a key column in an index”

Advertisement from Google After adding Index attribute with IsUnique set to true for string value in my code first model [Index(IsUnique = true)] public string Email { get; set; } , I’ve tried to update my database, but got following error: “column in table is of a type that is invalid for use as a key… Read More »

Unit test Data Access Layer (Entity Framework) with in-memory database

Unit testing code that uses data from database is a difficult task. If you use Entity Framework you can stub your data with Effort – in-memory Entity Framework data provider. David Bywaters describes how to use Effort if your create you context based in DbContext class. But if you use model first approach (.edmx already exists) you can follow… Read More »