Top "Ef-code-first" questions

EF Code-First is a way of using Microsoft's Entity Framework with POCO classes, as opposed to model-first or DB-first.

EF Including Other Entities (Generic Repository pattern)

I am using the Generic Repository pattern on top of Entity Framework Code First. Everything was working fine until I …

c# entity-framework entity-framework-4 repository-pattern ef-code-first
Multiple DB Contexts in the Same DB and Application in EF 6 and Code First Migrations

I'm new to Entity Framework. I am trying to setup an MVC Application what uses EF 6. I am using Code …

asp.net-mvc entity-framework ef-code-first entity-framework-migrations
How do I specify that a property should generate a TEXT column rather than an nvarchar(4000)

I'm working with the Code First feature of Entity Framework and I'm trying to figure out how I can specify …

c# entity-framework ef-code-first sql-server-ce data-annotations
Getting exact error type in from DbValidationException

I have the situation where I'm initializing my model in DatabaseInitializer() for EF 4.1 and get this annoying error "Validation failed …

.net entity-framework entity-framework-4.1 ef-code-first
Composite Key with EF 4.1 Code First

I am trying to figure out how to have a composite key using EF code First 4.1 RC. Currently, I am …

ef-code-first composite-key entity-framework-4.1
How to create a table corresponding to enum in EF6 Code First?

I've followed MSDN on how to handle enumerations in Code First for EF6. It worked, as supposed to but the …

c# entity-framework enums ef-code-first entity-framework-6
Defining multiple Foreign Key for the Same table in Entity Framework Code First

I have two entities in my MVC application and I populated the database with Entity Framework 6 Code First approach. There …

asp.net-mvc entity-framework ef-code-first foreign-keys foreign-key-relationship
How do I programmatically set the connection string for Entity-Framework Code-First?

I'm trying to write some code that allows me to switch between SQLCE (locally on my dev machine) and full …

sql-server asp.net-mvc entity-framework ef-code-first
How to specify database name in Code First?

How do I tell EF what to name the database and where to put it? If there is no connection …

entity-framework-4 ef-code-first
EF Code-First One-to-one relationship: Multiplicity is not valid in Role * in relationship

I'm attempting to do the following: public class class1 { public int Id {get;set;} [ForeignKey("Class2")] public int Class2Id {…

c# database entity-framework ef-code-first entity-framework-6