Is it normal to pass null variables from the client side to the service side?

2

My goal is to create three applications: WCF, ASP.NEW Web API and WPF.

My question is:

Is it normal, the data that we initialize on the client side ie (WPF) and that we move to the service (WCF) come to null?

Example of my code - WPF

       InitializeComponent();
       _gestaoInformacao = new Gestao_InformacaoUsersClient();

       newUser = new Utilizador { Username = "Joao" };
       _gestaoInformacao.addNovoUtilizador(newUser);

WCF:

 public void addNovoUtilizador(Utilizador newUser)
    {

        projectContext.Users.Add(newUser);
        projectContext.SaveChanges();
    }

Class User:

public class Utilizador
{
    [DataMember]
    [Key]
    private int id_utilizador;

    [DataMember]
    private String _username;

    [DataMember]
    public String Username
    {
        get { return _username; }
        set
        {
            _username = value;
            //OnPropertyChanged("Username");
        }
    }

    [DataMember]
    private String _password;

    [DataMember]
    public String Password
    {
        get { return _password; }
        set
        {
            _password = value;
            //OnPropertyChanged("Password");
        }
    }






}

The question here is that when I pass the newUser from WPF to WCF and run the debug to see what information passes, VS says that all user data is null (at least the username should have data)

This data, is it normal to be null, or is something wrong? Maybe with the Services settings.

    
asked by anonymous 18.01.2017 / 14:54

0 answers