2010-03-11 2 views
1

ODBC를 통해 액세스하는 서버의 데이터를 표시하기 위해 자체 RIA 서비스 공급자를 작성하려고합니다. 나는 egurelement를 따라 가려고한다. http://blogs.msdn.com/alexj/archive/2010/03/02/creating-a-data-service-provider-part-9-un-typed.aspx

나는 우리 자신의 IDataServiceMetadataProvider/IDataServiceQueryProvider 쌍을 썼으며, 내가하는 일에 어떤 에러도 없다.

I는 다음과 같이 자원 세트에 걸었습니다 :

ResourceType tableType = new ResourceType(
    typeof(Dictionary<string, object>), 
    ResourceTypeKind.EntityType, 
    null, 
    "Martini", 
    table_name, 
    false 
); 
tableType.CanReflectOnInstanceType = false; 
var prodKey = new ResourceProperty(
    "Key", 
    ResourcePropertyKind.Key | 
    ResourcePropertyKind.Primitive, 
    ResourceType.GetPrimitiveResourceType(typeof(int)) 
); 
prodKey.CanReflectOnInstanceTypeProperty = false; 
tableType.AddProperty(prodKey); 
var prodName = new ResourceProperty(
    "Name", 
    ResourcePropertyKind.Primitive, 
    ResourceType.GetPrimitiveResourceType(typeof(string)) 
); 
prodName.CanReflectOnInstanceTypeProperty = false; 
tableType.AddProperty(prodName); 

_MetaDataProvider.AddResourceType(tableType); 
_MetaDataProvider.AddResourceSet(new ResourceSet(table_name, tableType)); 

내가 요청이 자원 세트를 열거 위해 오는 참조하십시오. 내가 거기에있는 중단 점을 확인하고 리소스 집합과 형식이 모든 속성과 함께 있습니다.

그래도, 내가 얻을 출력은 다음과 같습니다

<?xml version="1.0" encoding="utf-8" standalone="yes" ?> 
- <service xml:base="http://localhost:2377/MartiniData.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app"> 
- <workspace> 
    <atom:title>Default</atom:title> 
    </workspace> 
    </service> 

그리고 $ 메타 데이터 버전

:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?> 
- <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> 
- <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0"> 
- <Schema Namespace="Martini" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm"> 
    <EntityContainer Name="Martini" m:IsDefaultEntityContainer="true" /> 
    </Schema> 
    </edmx:DataServices> 
    </edmx:Edmx> 

유형에 대한 실제 메타 데이터는 결코까지 보여줍니다, 오류가 표시되지 않습니다. 꽤 초조 한. 누구든지 어떤 생각?

답변

0

hmpf. 녹이다.

config.SetEntitySetAccessRule ("*", EntitySetRights.All);

이 초기화에서 누락되어 모든 항목이 필터링되었습니다.)