TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Herry Ng
NA
22
10.1k
entity framework cast back to objectcontex
Jun 9 2012 12:29 AM
hi, i want to ask is there a method/workaround using refrextion or else to cast control.datasource back to objectcontex.
My code:
//ERP_AR is entity framework model
ERP_AR oOC = new ERP_AR();
List<MyTable> oList = oOC.MyTable.ToList();
BindingSource bs =new BindingSource();
bs.DataSource = oList;
datagridview1.DataSource=bs;
//The issue is could i cast back datagridview1.DataSource back to oOC
BindingSource bs_temp;
bs_temp = (BindingSource) DataGridView1.DataSource; //SUCCESS cast back to binding source
ObjectContex oOC_Temp;
oOC_Temp = (ObjectContex) bs_temp;// --> NOT SUCCESS Cannot cast
Thx
Reply
Answers (
2
)
Why do I need to instantiate object?
Consuming Federated Rest Service in MetroApps Windows8