We have an existing application that relies heavily on stored procedures and untyped DataSets. I'd like to maintain that flexibility, but leverage the REST capabilities of ADO.NET Data Services. However, when I attempt to use the following code to expose the DataSet to ADO.NET Data Services:
namespace NewTechnologyDemo {
public class MyDataSource {
public IQueryable<DataRow> TheDataSet {
get {
using (SqlConnection connection = new SqlConnection("server=MySQLServer;integrated security=sspi;database=MyDatabase")) {
using (SqlCommand command = new SqlCommand("select * from Orders", connection)) {
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds.Tables[0].AsEnumerable().AsQueryable();
}
}
}
}
}
}
I get the error:
The server encountered an error processing the request. The exception message is 'On
data context type 'MyDataSource', there is a top IQueryable property 'TheDataSet' whose
element type is not an entity type. Make sure that the IQueryable property is of entity
type or specify the IgnoreProperties attribute on the data context type to ignore this
property.'.
I saw here that ADO.NET Data Services wants me to decorate the object with a DataServiceKey attribute, but I don't think there's anyway for me to do that.
Any ideas on how I could get this working? I feel like it should be possible...