Click here to Skip to main content
15,891,375 members
Home / Discussions / C#
   

C#

 
GeneralRe: Events related to the selection of text on a multiline textbox Pin
_ASPAle_7-Apr-10 7:21
_ASPAle_7-Apr-10 7:21 
AnswerRe: Events related to the selection of text on a multiline textbox Pin
Arun Jacob7-Apr-10 2:15
Arun Jacob7-Apr-10 2:15 
GeneralRe: Events related to the selection of text on a multiline textbox Pin
_ASPAle_7-Apr-10 7:18
_ASPAle_7-Apr-10 7:18 
QuestionCrystal Report with Dynamic Picture Pin
sachees1237-Apr-10 0:13
sachees1237-Apr-10 0:13 
QuestionReplacing objects, handling clones, dealing with write logs [modified] Pin
blackblizzard6-Apr-10 23:45
blackblizzard6-Apr-10 23:45 
AnswerRe: Replacing objects, handling clones, dealing with write logs Pin
Stanciu Vlad8-Apr-10 11:45
Stanciu Vlad8-Apr-10 11:45 
GeneralRe: Replacing objects, handling clones, dealing with write logs Pin
blackblizzard9-Apr-10 0:07
blackblizzard9-Apr-10 0:07 
GeneralRe: Replacing objects, handling clones, dealing with write logs Pin
Stanciu Vlad9-Apr-10 4:44
Stanciu Vlad9-Apr-10 4:44 
I think that tracking the clone is not the right way to do this; and .net's Transaction and TransactionManager classes I don't know if they wore built for customization. I looked a bit with Reflector in that assembly and all I can say is that messy stuff happens there.

The way I see a system like this is:
1) you should set up a workspace, the place where you keep your objects (original ones).
2) every clone provided to the user outside a transaction is "as it is". It's only purpose is to store values.
3) inside transactions, that's where all the crazy stuff takes place. A transaction should have a context (and by context I mean a part of or all the objects managed in the system workspace cloned and stuffed togheter outside the workspace). In the transaction context the user can do whatever he likes with the objects, because when he commits the transaction, the whole transaction context (meaning the changed objects) replaces the system workspace.
4) when a users requests to read or write a object in the context (the get or set method, or whatever implementation you have there) the object should be locked to the transaction that owns the context, and all the other transaction contexts should be notified about this lock (you do not want two users to change the same object in aproximatively the same time and both transactions to be comitted succesfully)
5) when a transaction is finished (successfully or not) all the objects locked to that transaction should be unlocked.

If you follow these steps maybe you can use the system like this:
using(MyCustomTransaction trans = new MyCustomTransaction())
{
    trans.Context.TransactionalObject.x = 10; // if you prefer strong typing
    (trans.Context.ManagedObjects["my object"] as aCustomTransactionalType).y = trans.Context.TransactionalObject.x * 100;
}
// of course, the commit is made automatically on the Dispose method :D


If you follow these steps there will be a lot of "lock(someContext)" and stuff like that. And the object locking mechanism in my opinion is the most messy part. A solution is to make a Mutex for each object in the system workspace, and center all the action in your TransactionManager and Transaction based on those mutex'es.

I don't know if this was the type of answer you were expecting Smile | :) )
I have no smart signature yet...

GeneralRe: Replacing objects, handling clones, dealing with write logs Pin
blackblizzard10-Apr-10 23:29
blackblizzard10-Apr-10 23:29 
GeneralRe: Replacing objects, handling clones, dealing with write logs Pin
Stanciu Vlad11-Apr-10 21:30
Stanciu Vlad11-Apr-10 21:30 
GeneralRe: Replacing objects, handling clones, dealing with write logs Pin
blackblizzard11-Apr-10 21:43
blackblizzard11-Apr-10 21:43 
Questionlocal file or public variables - what do oyu think? Pin
Jassim Rahma6-Apr-10 23:20
Jassim Rahma6-Apr-10 23:20 
AnswerRe: local file or public variables - what do oyu think? Pin
Mustafa Ismail Mustafa6-Apr-10 23:34
Mustafa Ismail Mustafa6-Apr-10 23:34 
GeneralRe: local file or public variables - what do oyu think? Pin
Jassim Rahma6-Apr-10 23:42
Jassim Rahma6-Apr-10 23:42 
GeneralRe: local file or public variables - what do oyu think? Pin
Mustafa Ismail Mustafa7-Apr-10 0:40
Mustafa Ismail Mustafa7-Apr-10 0:40 
GeneralRe: local file or public variables - what do oyu think? Pin
harold aptroot7-Apr-10 0:41
harold aptroot7-Apr-10 0:41 
AnswerRe: local file or public variables - what do oyu think? Pin
PIEBALDconsult7-Apr-10 3:49
mvePIEBALDconsult7-Apr-10 3:49 
QuestionProblem with printDocument1.PrinterSettings.Copies Pin
Reza Shojaee6-Apr-10 21:43
Reza Shojaee6-Apr-10 21:43 
QuestionScaleTransform Pin
Hema Bairavan6-Apr-10 21:24
Hema Bairavan6-Apr-10 21:24 
AnswerRe: ScaleTransform Pin
Luc Pattyn6-Apr-10 23:16
sitebuilderLuc Pattyn6-Apr-10 23:16 
QuestionNotify users Pin
Morgs Morgan6-Apr-10 20:30
Morgs Morgan6-Apr-10 20:30 
AnswerRe: Notify users Pin
Greg Chelstowski6-Apr-10 21:32
Greg Chelstowski6-Apr-10 21:32 
GeneralRe: Notify users Pin
Morgs Morgan6-Apr-10 21:37
Morgs Morgan6-Apr-10 21:37 
GeneralRe: Notify users Pin
Greg Chelstowski6-Apr-10 21:42
Greg Chelstowski6-Apr-10 21:42 
Questionrecord no update Pin
mjawadkhatri6-Apr-10 20:05
mjawadkhatri6-Apr-10 20:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.