質問

ストアドプロシージャと型指定のないDataSetに大きく依存する既存のアプリケーションがあります。その柔軟性を維持したいのですが、ADO.NET Data ServicesのREST機能を活用します。ただし、次のコードを使用してDataSetを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();
                }
            }
        }
    }
}
}

エラーが表示されます:

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.'.

こちらは、ADO.NET Data Services DataServiceKey <でオブジェクトをデコレーションしてほしい/ a>属性ですが、とにかくそれができるとは思いません。

これを機能させる方法についてのアイデアはありますか?私はそれが可能であるべきだと思う...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top