Last post Nov 12, 2012 01:07 AM by GUJIAN
Nov 05, 2012 03:47 PM|GUJIAN|LINK
i have a problem when i use the code at url of
when i follow the tutorials at part2 as the paragraph "Revising EntityDataSource Control Markup to Improve Performance" describe and
<asp:EntityDataSource ID="StudentsEntityDataSource" runat="server" ContextTypeName="ContosoUniversity.DAL.SchoolEntities" EnableFlattening="False" EntitySetName="People" EnableDelete="True" EnableUpdate="True"> </asp:EntityDataSource>
the page has a error:
unable to cast ContosoUniversity.DAL.SchoolEntities to System.Data.Objects.ObjectContext
how can i solve the problem?
Nov 05, 2012 03:54 PM|GUJIAN|LINK
By the way my enviroment is : win7 ultimate sql express and localdb ,vs2012
Nov 05, 2012 07:25 PM|tdykstra|LINK
The tutorial was written for EF 4.0, and VS 2012 uses EF 5. This blog on using EntityDataSource with the DbContext API that is the default in EF 5 may help:
I will be adding a note about this to the tutorial.
Nov 06, 2012 04:49 AM|Decker Dong - MSFT|LINK
Is your problem solved? Please feel free to feedback;)
Nov 08, 2012 04:29 AM|GUJIAN|LINK
because i reinstalled my system and reply you late , sorry.
and another two questions,
1)since the entitydatasource control is not designed for dbcontext ,so ,which datasource control should i select in asp.net?
2) every time i changed the FirstName to FirstMidName ,the vs2012 always report a error that say cannot find the property of FirstMidName
but i drag the edmx file to the root dir and drag back to the DAL dir the error disappeared.
thank you !
Nov 08, 2012 04:31 AM|GUJIAN|LINK
Yes and thank you very much.
Nov 08, 2012 03:33 PM|tdykstra|LINK
1. If you want to use a data source control with Entity Framework, EntityDataSource is the right one to use, it just hasn't been updated for DbContext yet. And it might not be, since the data-binding method that development efforts are focusing on now is
Web Forms model binding. For info on model binding, see the links in
2. I don't have an answer for this one -- the tutorial was written for VS 2010 and I haven't had a chance to update it for VS 2012 yet.
Nov 12, 2012 01:07 AM|GUJIAN|LINK