Sorry but I don't get your advice. In EntityDataSource the Include property it's just a string (a comma separeted value string). How can I use my context in the EntityDataSource?
Add Virtual Proerty of the type you wants to include in resultset. then you no need to add anything in select clause. Virtual property will link your objects in foreign key context.
kuria
Member
5 Points
41 Posts
Difference betwen EF and LINQTOSQL
Jan 23, 2013 01:53 PM|LINK
I early migrated to EF5 in .net framework 4.5. I have a problem
LINQTOSQL-GRIDVIEW
in event
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
if (e.Row.RowIndex >= 0) {
Alunni _alunno = (Alunni)e.Row.DataItem;
} }
and I can access to every child of _alunno simpy whit _alunno.Child notation
ENTITY FRAMEWORK - ENTITYDATASOURCE
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
if (e.Row.RowIndex >= 0) {
Alunni _alunno = (Alunni)e.Row.DataItem;
} }
I CANNOT access to child, only _alunno element have values. every child group count is 0.
Can someone help me?
roshcha
Member
144 Points
31 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 24, 2013 03:14 AM|LINK
hi,
Are you insert "Include" property of ENTITYDATASOURCE. use mapping tables in entitydatasource you have to Include mapping tables to Entity datasource.
marco_ked2
Member
7 Points
14 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 24, 2013 07:40 PM|LINK
Hi,
the "Include" property works only for the "first level" of the mapping tables. The Child tables of the Child tables are not included.
thaicarrot
Contributor
5132 Points
1465 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 25, 2013 07:08 AM|LINK
Could not you manually include it?
For example.
Add using System.Data.Entity
this.Context.Entity.Include(o => o.NestEntity.NestEntity)
Weera
marco_ked2
Member
7 Points
14 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 25, 2013 04:42 PM|LINK
Sorry but I don't get your advice. In EntityDataSource the Include property it's just a string (a comma separeted value string). How can I use my context in the EntityDataSource?
sachinp290
Member
88 Points
21 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 27, 2013 08:10 AM|LINK
Add Virtual Proerty of the type you wants to include in resultset. then you no need to add anything in select clause. Virtual property will link your objects in foreign key context.
marco_ked2
Member
7 Points
14 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 28, 2013 03:31 PM|LINK
I already have a Virtual Property on my entity. The problem is that it is not loaded when I use an EntityDataSource.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Difference betwen EF and LINQTOSQL
Jan 29, 2013 01:26 AM|LINK
Have you disabled the Include function?
Can you show us your codes?
sachinp290
Member
88 Points
21 Posts
Re: Difference betwen EF and LINQTOSQL
Feb 09, 2013 08:26 AM|LINK
writting virtual property its not enough. you have to manually add data for that virtual entity.
In you DAL, if you are fetching some list. then you have to assign value explicitly.