0

I have a problem, the program launches but it crashes with an exception : Message=Invalid object name 'dbo.Entity1Set'. What happens ?

class Program
{
    static void Main(string[] args)
    { 
        Model1Container db = new Model1Container();
        db.Database.CreateIfNotExists();
        Personne ps = new Personne();
        ps.Nom = "Loup";
        ps.Prénom = "Julien";
        db.PersonneSet.Add(ps);
        db.GetValidationErrors();
        db.SaveChanges(); //Exception ???
        Console.ReadKey();
    }
}

I don't know how and where to add "CreateDatabaseIfNotExists" in my code...

John Mary
  • 35
  • 2
  • 11
  • Possible duplicate of [Entity Framework Exception: Invalid object name](http://stackoverflow.com/questions/11581147/entity-framework-exception-invalid-object-name). Please make sure you've set `CreateDatabaseIfNotExists` – paulsm4 Jan 18 '16 at 23:27
  • ok but I don't know where and how to add CreateDatabaseIfNotExists in my code, exactly – John Mary Jan 18 '16 at 23:34
  • Any idea to help me ? If the problem is to ad d "CreateDatabaseIfNotExists", I edited my first message – John Mary Jan 19 '16 at 07:56

0 Answers0