User-515897137 posted
Thanks for this. Maybe is is not such a bad idea after all.
I have since extended a web.ui.gridview control to have an ObjectContainerDatasource object embedded to get data from the entity framework via an "Adapter" class.
The extended control uses reflection to create an instance of the adapter and call the CreateInstance() method to obtain information about the Entity Object we are adapting. in the OnInit() method as suggested
base.OnInit(e);
IVGridDataAdapter dataAdapter = CreateDataAdapter();
this.DataObjectTypeName = dataAdapter.DataTypeName;
this.DataSource =
this.dataSourceControl;
The bolded line is the bit that goes out to the entity framework to retrieve a suitable object to represent in the control. At design time, I am seeing
"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient Provider, not valid.", where I should be seeing the control rendering in design time. At run time, this all works
fine using only this adapter mechanism.
The c/s/m files are kept in the App_Data folder of my asp.net 3.5 web application.
Why might the control complain only at design time? The string is valid but I am confused by the part "...not intended to be used with the EntityClient Provider...". Am I breaking a rule here?
Could this be happening because the connection string isn't being "read" from the web.config at design time?
Any suggestions?
Note, I have also cross posted this one to the ADO.Net team
Cheers