Dear ladies and gents,
I'm trying to determine whether the .NET Framework implements a means
of transactional processing without the need for a database.
Essentially, I'd like to enlist light-weight portable business objects
within transactions so that that have the ability to roll-back if the
client of the object wishes to undo any changes made. For example, if I
had a, let's say for sake of simplicity, a person class that had two
public properties, Forename and Surname. If the user changes both
Forename and Surname then wishes to cancel those changes (meaning that
the object will return to it's original state (before the user modified
the object by means of either of the properties)) they could do by
invoking a method (such as 'Undo').
E.g.
Original values (before user interaction)
=============== =============
personInstance. Forename is equal to "Joe"
personInstance. Surname is equal to "Bloggs" (surprise, surprise, I bet
no one saw that coming)...
Then the user modifies the Forename and Surname...
=============== =============== ===========
personInstance. Forename = "John";
personInstance. Surname = "Smith";
The user then realises that the modifications he/she/it made needs to
be undone, for whatever reason...
The user could then invoke a method such as ...
personInstance. Undo();
The object would then undo all changes made so that all data would
reflect the the object state before the user modified it.
Data after undo...
=============
personInstance. Forename is equal to "Joe"
personInstance. Surname is equal to "Bloggs" (surprise, surprise, I bet
no one saw that coming)...
My current intention is to create deep copies of the object and pass
copies to the clients, let them update the copies and if all is well
(i.e. an undo is not required) then the copy of the object would then
replace the original. Otherwise, the copy object would be discarded
(effectively appearing as an undo operation)...
Please would a kind person, or not so kind (if that is how you prefer
to be perceived) offer some light on whether transactions can be used
quickly and easily to achieve the abovementioned task, or whether my
approach is a bad/good approach/whether there is a better and simpler
way.
Many thanks for taking the time to read this.
Have a nice day,
Craig. 3 3150
I concur. The Memento Pattern is the way to go for "Undo's".
"samuelhon" <sa****@gmail.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Hi Craig
You might want to have a look at this: http://www.dofactory.com/Patterns/PatternMemento.aspx
Its a simple undo pattern.
Sam
Hi Craig,
You can use COM+ services in managed code for transaction support just like
you always have in COM.
ServicedCompone nt on MSDN: http://msdn2.microsoft.com/en-us/lib...component.aspx
In the 2.0 framework there is a new namespace as well:
System.Transact ions
It contains managed classes that provide transaction processing support for
local and distributed transactions. For instance, you can use the
TransactionScop e class to enlist a System.Data.IDb Connection into a managed
transaction without explicitly using an implementation of IDbTransaction.
TransactionScop e class on MSDN: http://msdn2.microsoft.com/en-us/lib...tionscope.aspx
Using transactions along with commands (or mementos as another respondant
suggested) can make undo/redo operations transparent in code by encapsulating
the commit/rollback logic in separate components.
You can create a singleton in your application that will allow any caller to
undo the last operation, redo the previous operation or cancel the current
operation all by storing a current operation context. In my applications I
use a stack to implement the undo/redo context.
--
Dave Sexton
"GoogleEyeJ oe" <cr*****@hotmai l.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Dear ladies and gents,
I'm trying to determine whether the .NET Framework implements a means
of transactional processing without the need for a database.
Essentially, I'd like to enlist light-weight portable business objects
within transactions so that that have the ability to roll-back if the
client of the object wishes to undo any changes made. For example, if I
had a, let's say for sake of simplicity, a person class that had two
public properties, Forename and Surname. If the user changes both
Forename and Surname then wishes to cancel those changes (meaning that
the object will return to it's original state (before the user modified
the object by means of either of the properties)) they could do by
invoking a method (such as 'Undo').
E.g.
Original values (before user interaction)
=============== =============
personInstance. Forename is equal to "Joe"
personInstance. Surname is equal to "Bloggs" (surprise, surprise, I bet
no one saw that coming)...
Then the user modifies the Forename and Surname...
=============== =============== ===========
personInstance. Forename = "John";
personInstance. Surname = "Smith";
The user then realises that the modifications he/she/it made needs to
be undone, for whatever reason...
The user could then invoke a method such as ...
personInstance. Undo();
The object would then undo all changes made so that all data would
reflect the the object state before the user modified it.
Data after undo...
=============
personInstance. Forename is equal to "Joe"
personInstance. Surname is equal to "Bloggs" (surprise, surprise, I bet
no one saw that coming)...
My current intention is to create deep copies of the object and pass
copies to the clients, let them update the copies and if all is well
(i.e. an undo is not required) then the copy of the object would then
replace the original. Otherwise, the copy object would be discarded
(effectively appearing as an undo operation)...
Please would a kind person, or not so kind (if that is how you prefer
to be perceived) offer some light on whether transactions can be used
quickly and easily to achieve the abovementioned task, or whether my
approach is a bad/good approach/whether there is a better and simpler
way.
Many thanks for taking the time to read this.
Have a nice day,
Craig. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Frank Millman |
last post by:
Hi all
I have a question regarding inheritance. I have come up with a
solution, but it is not very elegant - I am sure there is a more
pythonic approach. Assume the following class definitions.
class Table:
def __init__(self,table_name,table_type):
class Master(Table):
|
by: xo55ox |
last post by:
Hi,
I have been trying to set up an automated restore process from prod to
backup server. First, I schedule the full database backup nightly,
transfer the backup file and restore it to the database on the backup
server. Meanwhile, I leave the database ready to accept transaction
log from the transaction log backup at noon daily.
And I had used different restore options to test out the transaction
that was being applied. And I couldn't...
|
by: Patrick |
last post by:
I understand that with IIS5.1 on Windows XP Professional SP1, I can
1) Either set under IIS Manager-> Any specific Virtual Directory->
Configuration->Options->ASP Script timeout for all pages within that
directory OR
2) Within a specific page, set the timeout as per
http://www.microsoft.com/windows2000/en/server/iis/default.asp?url=/windows2000/en/server/iis/htm/asp/vbob246s.htm
e.g. <% Server.ScriptTimeout = 1 %>
and that the value in...
|
by: Avanish Pandey |
last post by:
Hello All
We have 3 differen services (in 3 different server) Service A,B,C . We
want to implement distributed transaction when call methods of B and C
from A. Is it possible? if yes then how?
I have read the doc regarding this:
http://www.developer.com/net/asp/article.php/3385631
but it will not work when methods are in different services on
|
by: rein.petersen |
last post by:
Hi All,
Some of you may have encountered complications when trying to serialize
an object derived from CollectionBase (implementing ICollection or
IEnumerable).
Specifically, the XmlSerializer (as it is) won't allow you to treat an
ICollection (or IEnumerable) object as the root node without using
XmlAttributeOverides or sending in a new root attribute with the
serializer.
| |
by: ed_p |
last post by:
Hello,
I have implemented the singleton pattern for a class to hold a
SqlConnection object that
will be used thruout the application to create commands. My application
is a simple Windows Form
Application that connects to a MSDE Database. I was reading the thread
yesterday on this very
same subject, but it only mentioned ASP.NET Applications. Can anyone
tell me if it's a good idea
|
by: Louis LeBlanc |
last post by:
Hey folks. I'm new to the list, and not quite what you'd call a DB
Guru, so please be patient with me. I'm afraid the lead up here is a
bit verbose . . .
I am working on an application that uses very high volume DB
transactions - in the order of tens of millions per day . . .
Anyway, the current database which will remain nameless, but begins
with O and rymes with debacle (sorta), has a problem with high volume
work when it comes to...
|
by: David Jessee |
last post by:
I've been taking this approach when working with business entity objects:
1) Determine the ID of the object you need to work with (e.g. Invoice)
2) Get the Object instance of the Invoice...has a Buyer property, which is
an account class...a seller property which is also an accoutn
class....LineItems Collection which contains a number of different classes
that all implement the iLineItem interface).
3) Serialize the object into the...
|
by: =?Utf-8?B?UmF2aQ==?= |
last post by:
Hi,
I'm trying to pass values of different data-types to a web-service. I
thought it would be easier to box these values and pass them as a
System.object parameter, like
public void webmethod1(object a)
where a can be of type string, DateTime, float, etc..
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |