How to Prevent Concurrent Data Collisions


Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)StrataFrame User (261 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I not tried the example, but can put the code after initialicecomponent?, something like this in the constructor:
public CRUDForm(SomeDTO someDTO) : base(someDTO)
{
    InitializeComponent();
    PropertyToChange = value;        
}
This have to work.

Edited 12 Years Ago by Fabian R Silva, -
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Fabian. Thanks for replying.

I have really simplified MySubClass, and taken SF out of the equation, so this must be something silly in the way I am coding the subclass. My Code now is: (Just trying for instance to have all forms DarkGreen ) 

public class MyFormNotSF: System.Windows.Forms.Form

        {

          public voidInitializeComponent()

          this.BackColor = System.Drawing.Color.DarkGreen; }

        }

and in my Form to use the SubClass:

public artial class Form3 : MyFormNotSF  ........

 

 


Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Ivan. I am back to the concurrency issue  now. I have resolved being able to SubClass a Form (Uing C#) , thanks to another thread.

To Recap. If there is a DataColission, I want to add the fact to the BrokenRules collection and display a Message indicating this, and not allow the save. I have atached a Sample App. I have done the following in the App:

In my Base Form, Set AutoHandleCollisions to False

In the BO, left the CollisionNotificationType to RaiseEvent (The Default)

In My Base BO, put code into the BO_ConcurrencyException event as follows:

1. AddBrokenRule message

2. e.ReSaveRecord = true  (Set the flag so it will attempt to Resave the data) 

3.  this.Save  (Attemp to Save the record, which then should trigger the broken rules)

What is happening is that , for the Concurrency problem  record, The Broken Rule is NOT being displayed . It does not save the record (which is fine) but I want it to display the BrokenRules to indicate to the user that there has been a problem.
Attachments
Concurrency_04April.ZIP (71 views, 2.00 MB)
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Ger.

I have changed your sample project and am posting it here back to you.
I have created a new Base BO and added some code to it to demonstrate how you can accomplish what you are looking for.
If you feel like it, have a look at the help file under "Application Framework" -> "Business Layer" -> "Common Business Object Tasks" ->"Creating and Checking Business Rules" to get the a better understanding of the flow.

Hope it helps. Wink
Attachments
Concurrency_04April_A.ZIP (81 views, 2.00 MB)
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Ivan.

I have downloaded and extracted the amnded sample and it does what I want. Many thanks for putting in the time.

I will need to have a look at the code to get an understanding of how it works.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You're welcome, Ger. Cool
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Ivan. I am now trying to incorporate your suggestions into my live project  and am having two problems:

1. In the Base SubClass, when I try to add InitializeComponent into each constructor, it comes up with a error in the compiler (InitializeComponent does not exist in the current context)..... now if I comment the line out, it seems to work ok... Do I need this line in ?

2. In my actaul BO classes, I need to have specific code in the CheckRulesOnCurrentRow, so I want to run the Base Code in my subclass. When I put in  base.CheckRulesOnCurrentRow()  or base.CheckRulesOnCurrentRow(CheckRulesEventArgs e) I  get a complier message --> CheckRulesOnCurrentRow can only appear on the left hand side of += or -=

     
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi. I am really stuck on this as I cannot seem to get the Base Code running from my specific CheckRulesOnCurrentRow

Any feedback appreciated
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Anbody ?
Trevor Hendricks
Trevor Hendricks
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: StrataFrame Users
Posts: 13, Visits: 477
Ger, I'm new to SF but this is what I use.

public BaseBO()  : base()
        {
            InitializeComponent();
            //-- Add the necessary handlers
            this.AddHandlers();
        }

        public BaseBO(IContainer container)
            : base()
        {
            //This call adds the component to the given container.
            Container.Add(this);
            //This call is required by the Component Designer.
            this.InitializeComponent();
            //-- Add the necessary handlers
            this.AddHandlers();
        }

        /// <summary>
        /// Initializes a new instance of the BusinessObject1 class.
        /// </summary>
        /// <param name="info">The SerializationInfo for the object to create.</param>
        /// <param name="context">The StreamingContext for the source stream.</param>
        protected BaseBO(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            //This call is required by the Component Designer.
      this.InitializeComponent();
      //-- Add the necessary handlers
      this.AddHandlers();
        }

        /// <summary>
     /// Adds the necessary handlers for the BaseBO class.
     /// </summary>
     /// <remarks></remarks>
     private void AddHandlers()
     {
      this.CheckRulesOnCurrentRow += BaseBO_CheckRulesOnCurrentRow;
      this.SetDefaultValues += BaseBO_SetDefaultValues;
     }

HTH

Trevor
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search