Where is my object
Posted on 2014-10-27
I am new to c#. In my c# WCF application I have two endpoints Login() and GetTransaction(). In my TransactionService.cs I call a method in DataBaseIO.cs to create a user object and then call ReturnUser() in DataBaseIO.cs to return the object to TransactionService. This work fine.
// Return User object to calling program
public UserMaster ReturnUser()
Next I want to create a connection string . Again In my TransactionService.cs I call a method in DataBaseIO.cs to create a connection string object and then call ReturnConnString() in DataBaseIO.cs to return the object to TransactionService. This also work fine.
// Return connection strings object to calling program
public ConnectionStrings ReturnConnString()
Both objects are created in DataBaseIO but when I create my second object I note that the first object is null within DataBaseIO. Why is it not still there when I call DataBaseIO the 2nd time ?
I need to access the user object data when creating the connection string. Do I need to pass the objects I need back into DataBaseIO each time I make a call to one of its methods ?
I also noticed that in TransactionServices, if I call the GetTransaction() from Login() then even though within Login() my user object is populated with data when I call GetTransaction() method the object is null.