Reputation: 10792
In Nerd Dinner's Entity Framework repository, the queries' return type corresponds to the model and not to the EF conceptual entity.
public IQueryable<Dinner> FindAllDinners()
{
return db.Dinners;
}
...
public ObjectSet<Dinner> Dinners // NerdDinner.Designer.cs, line 76
The type of Dinner is NerdDinner.Models.Dinner.
I noticed the namespace for NerdDinner.Designer.cs is the same as the namespace for the model (NerdDinner.Models). I am assuming it pulled this namespace because it's sitting in the Models folder.
Question:
Can someone confirm that the return type of the EF queries is driven by the namespace of the EF config and that the namespace of the EF config is decided by the physical location of the EF files?
What options are available to make this technique work if the namespaces/locations are different and Code First CTP is not an option? Is this specific namespace configurable?
Upvotes: 0
Views: 113
Reputation: 1738
They are the same type. You may not have noticed that the classes in the Models directory are partial classes, which are composed with the EF classes. Partial classes must be in the same namespace.
Upvotes: 2