|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2010-10-14 08:15:35
Posts: 3,
Visits: 45
|
|
Hello,
I have two questions.
(1) I have a table in my Database which stores Folder Path. An example of the table is as follows:
**************************************
ID...................Path
1....................Level1
2....................Level1\Level2
3....................Level1\Level2\Level3
**************************************
I am using OCL to retrieve the path and the C# code to retrieve it is as follows:
string lPath = @"Level1\Level2";
string lOCLQuery = string.Format("Folder.allInstances->select(path='{0}')", lPath );
//Then I execute the OCL and assign the result to an IEcoList.
When I execute the above OCL, Eco return an empty List, meaning the required object has not been found even though the string exist in the database. But when I open the debugger and execute the query I get the expected result. The problem is not with the OCL as I have noted Eco return the correct result when the string does not contain the '\'. I think that the problem might be with '\'. Am I missing anything here?
(2) The second issue I'm having is with refreshing the state of Eco. Consider the following scenario:
(a) I have a File (File1.txt) in the database. (I'm using a File as example here as it is easier to understand but it can be with any object type)
(b) User A and User B get File1.txt.
(c) User B makes some modification to File1.txt and save it in the Database.
(d) At this time User A is accessing 'a dirty object' in the sense that File1.txt has been changed and User A is not aware of this change.
I need a way whereby Eco can inform User A that the object (File1.txt) has been modified. In another word, I need Eco to refresh itself at User A once an Object has been modified in the Database. My aim is to provide a message to User A as soon as a modification has been made to an object. The message can be as following:
"File1.txt has been modified. Do you want to reload it?"
If User A selects Yes, then the modified object is reloaded else the User keeps on working with the old object.
In short, I need Eco to be Dirty-Aware, such that, if the database has been modified then all the instances of Eco refresh itself and load the latest changes.
I would be grateful if you could help me on these issues.
Thanks.
Additional Info:
(1) OS: Win XP SP 3
(2) Visual Studio: Visual Studio 2008 Professional Edition
(3) Eco: 5.0.0.4560
(4) Database: SQL Server 2005 Express Edition / Oracle 10i
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2 days ago @ 17:12:46
Posts: 417,
Visits: 2 529
|
|
| (1) Open up a EcoSpaceDebugger and view what SQL is sent. Cant it be some locales setting on your db connection I wonder? (2) The scenario is what is genericly solved with the ECO-persistence-server and SyncHandler (detect changes performed by other clients and effectivly and safe merge those with this clients ecospace) - if you want a more hackish way to get this to happen you need some way to signal(1), someway to detect the signal(2) and someway to invalidate loaded data once the signal is received(3). - The #3 is done with IPersistenceService.Unload - #1 is frequently seen as a modelled property like a change time or a version number and #2 then handled with polling for changes in this value with a PS-query - If the SyncHandler is not appropriate for a scenario (although it always is (imho)) I would prefer to use MSMQ to signal#1 and a MSMQ listener for #2 /Hans
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 2011-07-14 17:05:00
Posts: 290,
Visits: 2 617
|
|
1: In OCL \ is an escape character, so you need \\ instead.
2: If you need automatic immediate notification then use the remote persistence service and periodically check for updates. If you can accept detecting when the update takes place then rely solely on optimistic locking instead.
Note though that:
A: Remote persistence change notification is NOT a replacement for optimistic locking, you should use that too.
B: When users are performing a long-running edit on an object it might be a good idea to add check-out / check-in functionality to your model.
====
Pete
|
|
|
|