Last post Jul 15, 2009 04:48 PM by german00
Apr 13, 2009 10:35 PM|tkr|LINK
I am trying to do my second Dynamic Data project. I am just working on setting it up and I created the project, the LinqToSQL class, and updated the Global.asax file with the correct data context. When I run my project, I get the page that lists the three
tables that were added to my LinqToSQL class, however when I click one of the tables, I get the following error:
Unable to cast object of type 'AFP_DPS_DD.AFP_DPSDataContext' to type 'System.Data.Objects.ObjectContext'.
The first project I did with a different datasource did not have this issue. Any idea what I am doing wrong?
Apr 14, 2009 06:45 AM|andreadottor|LINK
Are you sure that use the correct project template?
Linq2sql and Entity Framework have 2 different template project, because the templates and pages are a little different based on which model type is used.
With Linq2Sql models you need to use the Dynamic Data project.
With EntityFramework models you need to use the Dynamic Data Entities.
Apr 14, 2009 08:29 AM|sjnaughton|LINK
Andrea is right you must be using the Entity Framework model look in the DyanmicData\PageTemplate\List.aspx page and see what data source it is using if it is the EntityDataSource you have setup the wrong project. [:D]
Apr 14, 2009 10:06 AM|tkr|LINK
Right on. That is exactly what I did. I changed the project type and I am good to go.
Jul 15, 2009 04:48 PM|german00|LINK
Work for my, thanks