tsfaridi 0 Newbie Poster

Hello!

I am calling a table-valued function, of my database in SQL server 2008, from WCF Service and storing its results in LinkedList. On other side when I call this service and get this LinkedList, all of the nodes contains the same value. Code which I am using is as follow:

public class user
{
    public string name;
    public string email;
}

public class ChatService : IChatService
{

 public LinkedList<user> getOnlineList(string email)
    {
        LinkedList<user> online = new LinkedList<user>();
        JabsBaseDataContext db = new JabsBaseDataContext();
        IQueryable<onlineListResult> justOnline = db.onlineList(email);
        foreach (onlineListResult r in justOnline)
        {
            user os = new user()
            {
                name = r.fname + " " + r.lname,
                email = r.email
            };
            online.AddLast(os);
        }
        return online;
    }
}

chatService.getOnlineListCompleted += onlineRetrieved;
chatService.getOnlineListAsync(email);
void onlineRetrieved(object sender, getOnlineListCompletedEventArgs e)
{
   foreach(user us in e.Result)
   this.dispatcher.BeginInvoke(() => MessageBox.show(us.name+"\n"+us.email));
}