내 EF 모델이 SQL Server 데이터베이스에서 생성되었습니다. 그런 다음 EF 모델에 대해 RIAServices 용 DomainService를 생성했습니다. 엔티티 중 하나는 "EntryCategories"라고합니다. 내 사용자 인터페이스 디스플레이 모델은 실제 모델에서 상당히 다른 모습 때문에RIAServices가 손으로 작성한 DomainService에서 지원되지 않는 유형
이public IQueryable<EntryCategories> GetEntryCategoriesSet()
{
return this.Context.EntryCategoriesSet;
}
, 나는 그와 관련 기관에 대한 내 자신의 DomainService을 쓰기로했다 다음 DomainService이 방법을 만들었습니다. 그렇습니다, 우리는 생성 된 것을 수정하기위한 것이라는 것을 알고 있습니다.하지만 거기에는 많은 것들이 있습니다. 그리고 나는 작은 것에 집중하려고했습니다.
내가 생성 된 DomainService를 생성 DomainService에서 EnableClientAccess 속성을 제거하고 ClientDomainService라는 새로운 클래스를 추가하고, 캡슐화 : 나는 시도[EnableClientAccess()]
public class ClientDomainService : DomainService
{
// the generated domain service encapsulated in my new one.
private DataDomainService _dcds = new DataDomainService();
// reimplement one of the DataDomainService methods
public IQueryable<EntryCategories> GetEntryCategories()
{
return (from t in _dcds.GetEntryCategoriesSet() where t.EntryCategoriesVersions.EntryCategoriesVersionId == datahead.EntryCategoriesVersions.EntryCategoriesVersionId orderby t.DisplayOrder select t);
}
}
매우 주먹 것은 GetCateogoriesSet 방법을 구현할 것입니다 내 클래스의 다른 엔티티 (미도시)를 기반으로 필터링 된 기본 데이터가 있습니다. 나는이를 만들 때 오류가 나타납니다 : 내 CientDomainService을 주석 경우
Entity 'DataProject.Web.EntryCategories' has a property 'EntryCategoriesVersionsReference' with an unsupported type
, 생성 된 DomainService에 EnableClientAccess 속성을 교체하고, 원래 GetEntryCategoriesSet 방법에서 프로젝트를와 똑같이 LINQ 필터링을 배치 오류없이 컴파일합니다.
새로 생성 된 DomainService에는 어떤 특별한 기능이 있습니까? metadata.cs 파일입니까?
Tor Haugen의 답이 저에게 효과적이었습니다. 나는 그의 대답을 회상 할 수있는 충분한 담당자가 아직 없다. 필자는 다른 프로젝트에서 재사용 할 수있는 RIA 서비스 도메인 컨텍스트의 기본 클래스를 만들었으며 실제로 엔티티를 정의하는 클래스는 [LinqToEntitiesDomainServiceDescriptionProvider] 특성을 가지고 있습니다. 그러므로 objectcontext에 대한 하드 참조는 그 특정 objectcontext에서 엔티티를 직접 참조하기 때문에 큰 문제는 아닙니다 (나에게). 모든 도움에 감사드립니다! –
이 문제가 발생할 수있는 방법에 대한 자세한 설명은이 스레드를 읽으십시오. http://forums.silverlight.net/p/233457/583536.aspx –