Frage

Wir haben eine bestehende Anwendung, die stark auf gespeicherte Prozeduren und nicht typisierte Datasets setzt. Ich möchte, dass die Flexibilität, halten, sondern die REST-Funktionen von ADO.NET Data Services nutzen. Jedoch wenn ich versuche, den folgenden Code zu verwenden, um den Datensatz zu ADO.NET Data Service zu belichten:

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();
                }
            }
        }
    }
}
}

Ich erhalte die Fehlermeldung:

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

dass ADO.NET Data Services will, dass ich das Objekt mit einem DataServiceKey Attribut, aber ich glaube nicht, dass es sowieso für mich, das zu tun.

Alle Ideen, wie ich diese Arbeit zu bekommen? Ich fühle mich wie soll es möglich sein ...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top