Passing classes to methods
Posted on 2014-11-15
I have a WCF application which has a TransactionServices.cs . In here I create and instance of a User class called MyUser and an instance of an Environment class called MyEnvironment. I have another class definition called Commands.cs in which I have defined various commands. These commands will require access to MyUser & MyEnvironment so I have created methods within Commands.cs to receive both of these classes from TransactionServices.cs
MyCommands = new Commands();
public void ReceiveMyUser(UserMaster MyUser)
public void ReceiveMyEnvironment(Environment MyEnvironment)
When ReceiveMyUser(UserMaster MyUser) is envoked from TransactionServices.cs I can see that MyUser is passed. However when ReceiveMyEnvironment(Environment MyEnvironment) is envoked, MyEnvironment is passed but MyUser is Null. When I call TESTCMD1 after these 2 receive methods , both MyUser & MyEnvironment are null. Why are these objects set to null each time I call MyCommands ? Is there a better way of doing this ?