0

as you've seen in my recent Posts, I'm trying to make use of the Entity Framework. So our DB-guy created me a Table called SalesOrder.

So, I created a Project called DataLayer.SQL and used the Wizzard for the Model first Creation of my Table. BUT: Even if I did not change anything, it tried to connect to SalesOrderS instead of SalesOrder. No Problem I thought and added the Table-Attribute. But then I get the Error the context and DB are not async. Ok no Problem, I removed everything, created a empty Model and added the Table manually, but now I get the Error

"No connection string named 'SimpleSalesContextContainer' could be found in the application config file."

But he is in the App.Config of the DataLayer.SQL Project.

Furthermore it seems like I have to edit the generated Entity manually by adding the Key Attribute?

Im sorry for my confusion, in every Tutorial I looked and tried everything worked as expected (Well, as usual in Tutorials).

Liam
  • 27,717
  • 28
  • 128
  • 190
Matthias Müller
  • 3,336
  • 3
  • 33
  • 65
  • 2
    The application will be using it's own config, if it's a web-app then you will need to add the relevant connection string to the web.config –  Apr 25 '14 at 09:50
  • Hum, true, so the App.Config, is generally useless, right? Do you have a idea why I have to set Tags manually? That that the correct procedure? – Matthias Müller Apr 25 '14 at 10:51
  • If I already had a db I'd go for db-first rather than model-first (because the model isn't first, you're trying to match it up with an existing db). Because you're doing it that way around, and having to match up class objects to sql tables you will run into issues such as the naming one you've had. '`SalesOrder`' (singular) is a terrible name for a collection, and really should be the name of a single entity class within the `SalesOrders` (plural) collection. i.e. `SalesOrders` contains a list of type `SalesOrder`. – Mashton Apr 25 '14 at 12:56

0 Answers0