|
I have a set of business objects on a server, replicated on a client. The state of the client should always, after a work unit, or session, should be replicated on the server, i.e., when a user clicks save on the client after adding a new item, the Save method of the object persists its state to the client database.
I now want to transfer that state to the server, instantiate an object of the same class on the server, and invoke its Save method, thus replicating exactly the client operation.
Am I mad, or is this a workable solution? I am trying my best to keep all responsibilities and encapsulation, and avoid code in the objects knowing if they are client side or server side.
|
|
|
|
|
Idea 1:
Write a wrapper for the objects, which contains the same methods and properties. The client creates a new wrapper object. The wrapper constructor creates a local object, and an object on the server. Whenever the client calls a method of the wrapper, it calls this method on the local object _and_ on the remote object. If multiple users work with the same object, you have to synchronize the local object with the server object before every call.
Idea 2:
When the client opens an object, set a "locked" flag on the remote object. The client can work with the object, and when the user clicks "Save", it is replicated on the server and the "locked" flag is reset. The saved/unlocked objects will always be equal.
|
|
|
|
|
My problem here is that the client normally only connects to the server once a day, normally by a dial-up, so the wrapper can't call methods on both objects at the same time. My biggest issue is the creation of the remote object on the server after it has been created on the client.
Once it exists on the server, by whatever means, I can just execute method calls on the server at the same time as the client.
|
|
|
|
|
Why isn't it possible to serialize the new object on dialup, deserialize it on the server, and then save it?
|
|
|
|
|
It is possible, and probably what I will do, but I will have to serialise it before saving it on the client so that it is still in its unsaved state on the server. This way exactly the same operation is performed on both objects, leaving them in the same state.
Subsequent operations on the client object, except for editing, will only require the same operation on the server, and not a transfer of the whole state.
|
|
|
|
|
- User saves the object offline: Serialize it to a temporary file.
- User dials up: Deserialize the offline-object (you're back to the state before the save-button had been clicked), serialize it to the server, save on server, save on client.
Everything you would send to the server if you were connected can be sent to a file. On dial up you can read the changes from the file, including all serialized object which has been created offline.
|
|
|
|
|
The problem is that the user will need to access the object in its after-save state before connecting to the server. Most clients will only connect daily, in the morning, or at close of business.
|
|
|
|
|
You can store all the method calls (which you would send to the server if there was a connection) to an "objectID.log" file, and the object itself to an "objectID.obj" file. When the client connects, you deserialize the object from "objectID.obj" and save it on the server, next you read and send the after-save actions from "objectID.log".
|
|
|
|
|
Yes, I am thinking of using SOAP objects to format the method calls in a standard way, without too much coding, and storing the SOAP method calls on top of the object state in a FIFO queue. When the queue is serviced, the first item off should be an object, and every subsequent item until the next object is a method call for the first object.
|
|
|
|
|
I have found a lot of information about how to import C functions from DLL's and use them in C# but nothing about how to use a static C++ lib or calling unmanaged C++ "directly". Is this not possible?
|
|
|
|
|
why do not you share your information
sdfasd
|
|
|
|
|
I want to read a char from console (like Console.Read) but I need to not wait the ENTER Key.
I know that it can be done using Windows API but this solution doesn't work for me since I'm not using the windows shell (cmd.exe). In fact, I'm running this appication through Cygwin telnet from a VT100 terminal.
I guess that it could be achieved creating a new class which inherits from TextReader and set it as a console stream reader (Console.SetIn), but I'm not sure (still looking ). Any suggestion/samples?
thanks.
|
|
|
|
|
You want to read a char from console but you need to not
wait the ENTER key,It is possible?
I do not think so.Please forgave my ignorance,you do not
enter the key how the computer know that when your inputing
is over.I think maybe you can change the ENTER key to another key .
sorry for my poor english and ignorance.
sdfasd
|
|
|
|
|
It's simple: the input is ready after reading one char. The ENTER key is like any other character and can be read so I could know when the user's input is over.
I just want to read characters one by one, byte by byte.
It can be easily done with C/C++, but I don't know how to do it with C#
In fact, "ReadConsoleInput" from kernel32.dll does what I need but I can't use it as I have explained before.
|
|
|
|
|
Oh,I know what is your means.
you want to do :while((c=getchar())=="key");
maybe you can do it in C# with the same way.
I will try it hurry up.
sorry for my poor English.
sorry for my poor English
|
|
|
|
|
|
The MSDN doc says that Console.Read()
reads the next Character from standard
input.
Thank You
Bo Hunter
|
|
|
|
|
I have gotten some information about it. It works in the Console but I still need to get it working in my particular environment. If anyone is interested:
http://www.dotnet247.com/247reference/msgs/1/5930.aspx
http://www.gotdotnet.com/community/usersamples/Default.aspx?query=ConsoleEx
http://www.mentalis.org/soft/class.qpx?id=2
regards.
|
|
|
|
|
I am getting a Stack Overflow Exception anytime I try to instantiate my custom class any ideas?
|
|
|
|
|
Any recursive method/contructor calls?
|
|
|
|
|
Um like reinstantiating the class in the constructor?
|
|
|
|
|
Did you trace the constructor call in single-step mode? Maybe it calls a neverending method, or it calls itself like that:
public MyClass(int x):this(x){}
|
|
|
|
|
Or just do it in DataGrid
|
|
|
|
|
Hi all,
I was wondering if anybody could help me figure how to make an icon appear on the tab part of the tab pages along with the text.
-Vish
|
|
|
|
|
Hello again,
My earlier post got results related to invoking a script within the context of a page. This is interesting but not what I was looking to do. The execScript() method referred to lets you pass in a script string and have it executed.
I need to invoke a script that is part of the downloaded page after it loads. An example script would be signalling a custom event. Can anyone out there help?
Thanks in advance and Happy Thanksgiving!
|
|
|
|