SL5 + EF + WCF アプリでこの Web サービス エラーが発生することがあります。
「ドメイン操作エントリ 'AddUserPresentationModelToRole' のパラメーター 'role' は、定義済みのシリアル化可能な型の 1 つである必要があります。」
これは同様のエラーですが、彼の解決策は私にはうまくいきません。
データベース エンティティをクライアントに表示する 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)
{
//....
}
}
およびプレゼンテーションモデル:
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 が手作りの DomainService でサポートしていない型 - LinqToEntitiesDomainServiceDescriptionProvider を使用して手作りのサービスをデコレートすることは、同じことを言っているようです。