2013-01-15 3 views
0

SL5 + EF + WCF 응용 프로그램에서이 웹 서비스 오류 가끔이 표시됩니다.도메인 조작 항목 xxx의 매개 변수 xxx는 미리 정의 된 직렬화 가능 유형 중 하나 여야합니다

도메인 조작 항목 'AddUserPresentationModelToRole'의 "매개 변수 '역할'은 사전 정의 된 직렬화 가능 유형 중 하나 여야합니다."

here도 비슷한 오류이지만 해결책은 저에게는 적합하지 않습니다.

나는 codegenned 내 클라이언트에 데이터베이스 엔티티를 표면 DomainService 있습니다

[EnableClientAccess()] 
public partial class ClientAppDomainService : LinqToEntitiesDomainService<ClientAppUserEntitlementReviewEntities> 
{ 

    public IQueryable<Account> GetAccounts() 
    { 
     return this.ObjectContext.Accounts; 
    } 
    //..etc... 

및 프리젠 테이션 모델을 표면화되고 내 사용자 정의 서비스, DB 엔티티.

[EnableClientAccess]  
[LinqToEntitiesDomainServiceDescriptionProvider(typeof(ClientAppUserEntitlementReviewEntities))] 
public class UserColourService : DomainService 
{ 

    [Update(UsingCustomMethod = true)] 
    public void AddUserPresentationModelToRole(UserPresentationModel userPM, Role role, Reviewer reviewer) 
    { 
     ... 
    } 

    public IDictionary<long, byte> GetColourStatesOfUsers(IEnumerable<RBSUser> listOfUsers, string adLogin) 
    { 
     //.... 
    } 
} 

과 PresentationModel

:
public class UserPresentationModel 
    { 
     [Key] 
     public long UserID { get; set; } 

     public byte UserStatusColour { get; set; } 

     public string MessageText { get; set; } 

     [Include] 
     [Association("asdf", "UserID", "UserID")] 
     public EntityCollection<Account> Accounts { get; set; } 

     public DateTime AddedDate { get; set; } 

     public Nullable<long> CostCentreID { get; set; } 

     public DateTime? DeletedDate { get; set; } 

     public string EmailAddress { get; set; } 

     public long EmployeeID { get; set; } 

     public string FirstName { get; set; } 

     public Nullable<bool> IsLeaver { get; set; } 

     public string LastName { get; set; } 

     public DateTime LastSeenDate { get; set; } 

     public string LoginDomain { get; set; } 

     public string LoginName { get; set; } 

     public byte WorldBuilderStatusID { get; set; } 

    } 

는 또한 솔루션을 안정적으로 실패를 얻을 수 없습니다. 내가 서비스를 약간 바꿀 때마다, 즉 다시 컴파일하게되면 모든 것이 작동하는 것 같습니다.

RIAServices unsupported types on hand-built DomainService - LinqToEntitiesDomainServiceDescriptionProvider를 사용하여 손으로 작성된 서비스를 꾸미는 것이 효과가 있습니다.

답변

0

가능한 대답 here도 결과가 여기에 게시됩니다.

콜린 블레어 출신 : 나는 조금 놀랍다. 나는 이전에 이름이 새겨진 업데이트에 추가로 관심을 기울이는 사람을 보지 못했다고 생각한다. RIA Services의 버그 일 수도 있습니다. 무엇을 성취하려고합니까?

ObjectContext가 올바르게 삭제되지 않기 때문에 메모가 누락되었습니다. LinqToEntitiesDomainSerivce를 사용하지 않는 이유가 있습니까? ObjectContext의 수명을 관리 할 수 ​​있습니다.

결과 :

1) 이는 의미가 있습니다. 더 현명한 매개 변수 (ints/strings)로 리팩토링하고 모든 작업을 수행했습니다.

2) LinqToEntitiesDomainSerivce를 사용하는 3 개의 서비스를 하나의 서비스로 통합했습니다. 이전에 나눠 보았던 이유는 PresentationModel로 CustomUpdate를하는 것이 효과가 없다는 가정 이었기 때문에 대신 DomainService를 상속해야했습니다. 나는 방법을 만들어이 문제를 해결했다 :

// need this to avoid compile errors for AddUserPresentationModelToRole.. should never be called 
public IQueryable<UserPresentationModel> GetUserPresentationModel() 
{ 
    return null; 
}