How can I force a commit of BusinessProcess

71 views
Skip to first unread message

VKF Developer

unread,
May 27, 2025, 8:05:28 AMMay 27
to Migrated By Firefly
In my scenario I have a UIController with
RowLocking = LockingStrategy.OnUserEdit;
TransactionScope = TransactionScopes.RowLocking;
and I call a BusinessProcess which should insert some data

protected override void OnLeaveRow()
{
var mytable = new DbTable.mytable();
mytable.Insert(() => Gid.Value = "myData", ProcessId.Value = 12345);
}

after executing this BusinessProcess the transaction has to be committed, because then I want to readout this value from another thread. DbTable.mytable is not the table wich is currently locked.
I tested several TransactionScopes in my BusinessProcess but unfortunately the data is only written when my UIController commits its transaction.
It is crucial, that the current lock on my UIController is held.

How can I force the commit in my BusinessProcess?

Harry Kleinsmit

unread,
May 27, 2025, 8:22:11 AMMay 27
to Migrated By Firefly

Hi,

 

You could try the using statement (not the using directive!). See: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using

This should free the resource immediately after the end of the using statement:

 

So in your case it would be something like this:

 

protected override void OnLeaveRow()
{
   using (var mytable = new DbTable.mytable())

   {


      mytable.Insert(() => Gid.Value = "myData", ProcessId.Value = 12345);

   }
}

 

Don’t know if it will work. Let me know! 😉

 

Best regards,

Harry Kleinsmit.


Op dinsdag 27 mei 2025 om 14:05:28 UTC+2 schreef VKF Developer:

Noam Honig

unread,
May 27, 2025, 8:32:56 AMMay 27
to VKF Developer, Migrated By Firefly
There are several solutions for that.

One - you can use a separate non transactional database connection - for that second entity.
Send its constructor a connection you create like this:
ENV.Data.DataProvider.ConnectionManager.GetNoTransactionSQLDataProvider("YourDatabaseName")

That's good for counters, sessions and other things you want to record without disturbing the main transactional connection.

Another option is to do that insert in another thread (which will also open a connect) Common.RunOnNewThread

I'd go with solution 1.



Noam Honig  
Founder & CEO


--
You received this message because you are subscribed to the Google Groups "Migrated By Firefly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrated-by-fir...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/migrated-by-firefly/0056af9e-11e2-4fd4-b5a9-2e72e2e911c2n%40googlegroups.com.

VKF Developer

unread,
May 27, 2025, 8:57:24 AMMay 27
to Migrated By Firefly
How can we do this with our Oracle-Database?

public myTable() : base("myTable", ENV.Data.DataProvider.ConnectionManager.GetNoTransactionSQLDataProvider("OurDatabaseName"))

We get an exception: Can't find NoTransactionEntityDataProvider. Did you call it's InitMethod'

Noam Honig

unread,
May 27, 2025, 12:22:26 PMMay 27
to VKF Developer, Migrated By Firefly
See if you have a class in ENV called NoTransactionEntityDataProvider - if so call it's Init method in the program.main when the application loads - it'll init the needed code

Noam Honig  
Founder & CEO

VKF Developer

unread,
May 28, 2025, 4:14:10 AMMay 28
to Migrated By Firefly

I have a private class "NoTransactionEntityDataProvider" in ENV.ConnectionManager but without a Init-Method.

remark: since now we only have one Oracle-Connection/DataProvider

Harry Kleinsmit

unread,
May 28, 2025, 4:38:39 AMMay 28
to Migrated By Firefly
Hi,

Next to the class in the ConnectionManager you should also have the program NoTransactionEntityDataProvider.cs in your ENV.Data.DataProvider. In both this class should be set to public.

In your application you can init this class in your program.cs at the Init() class like this: ENV.Data.DataProvider.NoTransactionEntityDataProvider.Init();

At your Shared\DataSources.cs you can use this setting as follows:

        public static DynamicSQLSupportingDataProvider MSSQL
        {
            get
            {
                return ConnectionManager.GetNoTransactionSQLDataProvider("MSSQL"); // Without Transactions!
                //return ConnectionManager.GetSQLDataProvider("MSSQL"); // With Transactions!
            }
        }

However, this is for MSSQL. I don't know if this will work also for Oracle.

Hope this helps.

Best regards,
Harry Kleinsmit.
Op woensdag 28 mei 2025 om 10:14:10 UTC+2 schreef VKF Developer:

VKF Developer

unread,
May 28, 2025, 5:48:29 AMMay 28
to Migrated By Firefly
Hi Harry,

I don't find a Init-Method:
ENV.Data.DataProvider.ConnectionManager.NoTransactionEntityDataProvider.Init();
=> NoTransactionEntityDataProvider does not contain a definition for Init()

Thanks for your effort

Harry Kleinsmit

unread,
May 28, 2025, 6:04:01 AMMay 28
to Migrated By Firefly
Hi,

I guess you are missing the NoTransactionEntityDataProvider.cs in your ENV. I don't think it is standard included in the migration. I also had to specially request it. Gilad send me this program separately, matching my version of Firelfy.
After installing and using it there were some issues in special cases (like SQLDirect) which Noam fixed very quickly.

I guess you should ask Gilad for it.

Best regards,
Harry Kleinsmit.

Op woensdag 28 mei 2025 om 11:48:29 UTC+2 schreef VKF Developer:

Noam Honig

unread,
May 28, 2025, 6:26:03 AMMay 28
to VKF Developer, Migrated By Firefly
Here's the source code - add it to env and call its init

Noam Honig  
Founder & CEO

NoTransactionEntityDataProvider.cs

VKF Developer

unread,
May 28, 2025, 7:31:26 AMMay 28
to Migrated By Firefly
problem is solved. Thank you all very much. :)
Reply all
Reply to author
Forward
0 new messages