How to pass multiple parameter in DomainService - WCF

Posted by S.Amani on Stack Overflow See other posts from Stack Overflow or by S.Amani
Published on 2011-01-08T15:17:29Z Indexed on 2011/01/09 13:53 UTC
Read the original article Hit count: 391

Filed under:
|
|
|

Hi,

Let's say I have a window which should submit 3 model in client side (Silverlight Client Application). My problem is each time I submit the form, data on the server side which I passed them from client are empty.

I've used nested class which contains my models, instead of passing multiple object as parameter, but it didn't work again.

My Personnel Data Transfer Object Code is something like this :

[DataContract]
public class PersonnelDTO : EntityObject
{
    [Key]
    [DataMember]
    public int PersonnelId { get; set; }

    [Include]
    [DataMember]
    [Association("Personnel_ID", "PersonnelId", "Personnel_ID")]
    public Personnel Personnel { get; set; }

    [Include]
    [DataMember]
    [Association("Personnel_Info_ID", "PersonnelId", "Personnel_Info_ID")]
    public Personnel_Info PersonnelInfo { get; set; }
}

I fill up this model to pass data from client to server (DomainService). and also my domain service code is :

    [Invoke]
    public void AddPersonnel(PersonnelDTO personnelDTO)
    {
        // Model are EMPTY in DTO
        ObjectContext.AddToPersonnels(personnelDTO.Personnel);
        ObjectContext.AddToPersonnel_Info(personnelDTO.PersonnelInfo);
        ObjectContext.SaveChanges();
    }

I don't know if there is a way to pass multiple parameter in WCF Service method include Generic List.

Any advice will be graceful. Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight