Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Remoting : store client in sql Server database

Posted on 2005-04-11
11
Medium Priority
?
252 Views
Last Modified: 2010-04-16
Hi experts,

I need to store my clients in my Sql Server db instead of hashtable or arraylist.
What is the best way to do this and how to retrieve or recreate the client ?

My app is something like this:
http://www.c-sharpcorner.com/Code/2003/Nov/RemotingEvents.asp (solution 2)

Thanks in advance for your answers.
0
Comment
Question by:noulouk
  • 6
  • 5
11 Comments
 
LVL 9

Author Comment

by:noulouk
ID: 13759718
Thanks Dungla,

but what I need is to insert the ObjectUri (I think) of my clients in SqlServer.
Then I want to be able to select a particular one and rebuild this client (don't know how to do) to send the message.

Hope you see what I need.
0
 
LVL 13

Expert Comment

by:dungla
ID: 13759737
You mean that you want to update your client?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:noulouk
ID: 13759773
In sample code(http://www.c-sharpcorner.com/Code/2003/Nov/RemotingEvents.asp (solution 2)), the client subscribes to the remote object. The client is stored in ArrayList or HashTable.
I want to store in SqlServer.
0
 
LVL 13

Expert Comment

by:dungla
ID: 13759824
So each time when you attach new client to server, make a connection to SQLServer and insert new data.

SqlConnection cn = new SqlConnection("string");
if (client.Exist(ClientID))
   update client data
else
  insert new client
0
 
LVL 9

Author Comment

by:noulouk
ID: 13759854
Ok I'm agree with you.
The problem is what ClientID to insert in Sql Server (ObjectUri, something else)

And when I select the ClientID from the db, how to rebuild the client to send a message.

Thanks for helping me.
0
 
LVL 13

Expert Comment

by:dungla
ID: 13759897
You need to store all available information of the client. Ok, I will try to setup a simple project based on solution 2 that you gave me.
0
 
LVL 9

Author Comment

by:noulouk
ID: 13759961
[Serializable]
public class RemotingServer : MarshalByRefObject, RemotingManager.IServer
{
     private ArrayList _clients = new ArrayList();

     public void Subscribe(System.Collections.ArrayList aClient)
     {
          RemotingManager.IClient Client = (RemotingManager.IClient)aClient[0];
          _clients.Add(Client);
          System.Diagnostics.Debug.WriteLine("Client added");
              Client.ReceiveMessage("Client added.");  // send message to the client
     }
}

In this code, the client is stored in ArrayList.

Now, I need:
[Serializable]
public class RemotingServer : MarshalByRefObject, RemotingManager.IServer
{
     // private ArrayList _clients = new ArrayList();  

     public void Subscribe(System.Collections.ArrayList aClient)
     {
          RemotingManager.IClient Client = (RemotingManager.IClient)aClient[0]; // Get the client

// Instead of register the client in _clients ArrayList, i want to register in Sql Server.

//          _clients.Add(Client);
// INSERT INTO clientTable  ...  VALUES  ...            Which values   ?????????

          System.Diagnostics.Debug.WriteLine("Client added");

// To understand my needs:
// SELECT * FROM clientTable WHERE   ...               values   ?????????

//  RemotingManager.IClient ClientFromSqlServer =(RemotingManager.IClient)  ????? don't know how to do

              ClientFromSqlServer.ReceiveMessage("Client From SqlServer added.");  // send message to the client
     }
}

Thanks for giving me your precious time.
0
 
LVL 13

Accepted Solution

by:
dungla earned 2000 total points
ID: 13760017
I've downloaded the code from the link that you gave me. Client was configure by a configure file. Then I think that you must store the ObjectUri and the configure file that belong to the client
0
 
LVL 9

Author Comment

by:noulouk
ID: 13760043
Ok. And after that how can I (rebuild) the client to send a message from the server.
Is there a method to do that in RemotingConfiguration , RemotingServices or any other Framework class ?
0
 
LVL 9

Author Comment

by:noulouk
ID: 13770673
I think it's possible to do, but I'll have to serialize the class and register in Sql Server and finally I don't know exactly how to rebuild the client.
Thanks for your help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question