LINQ-to-Dataset 데이터 소스와 함께 ADO.NET 데이터 서비스를 사용할 수 있습니까?

StackOverflow https://stackoverflow.com/questions/1632316

  •  06-07-2019
  •  | 
  •  

문제

저장된 절차 및 유형화되지 않은 데이터 세트에 크게 의존하는 기존 응용 프로그램이 있습니다. 그 유연성을 유지하고 싶지만 ADO.NET 데이터 서비스의 REST 기능을 활용하고 싶습니다. 그러나 다음 코드를 사용하여 데이터 세트를 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 속성이지만 어쨌든 내가 그렇게 할 것이 없다고 생각합니다.

내가 어떻게 작동 할 수 있는지에 대한 아이디어가 있습니까? 가능하다고 생각합니다 ...

도움이 되었습니까?

해결책

의심 스럽다 DataSet 유용 할만 큼 충분한 메타 데이터에 가까운 곳에있을 것이며, 수업이 필요합니다. 나는 냄비 몇 개를했다 (여기서 시작) 유용 할 수있는 LINQ-to-SQL로 작업 할 때

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top