Recent

Author Topic: Migrate vb.net to Lazarus  (Read 1202 times)

Packs

  • Sr. Member
  • ****
  • Posts: 416
Migrate vb.net to Lazarus
« on: January 19, 2025, 08:05:59 am »
I have one application which is written logic part in c# and front end vb.net

Using remoteing.

I would like to migrate to freepascal ui....

But I want to keep c# logic same.

In this project every thing is send through dataset


cdbc

  • Hero Member
  • *****
  • Posts: 1806
    • http://www.cdbc.dk
Re: Migrate vb.net to Lazarus
« Reply #1 on: January 19, 2025, 08:23:08 am »
Hi
Well, nobody's stopping you from doing that...
AFAIK C# still allows you to create a regular dll, *not* the managed .net kind.
So, stuff all your 'logic' into that /regular/ library and fpc/lazarus will happily call into that library.  8)
Mind you, the library has to obey C conventions, *not* C# or C++
All you now have to do, is create your visual GUI in lazarus, that relies on your C# backend-library...  8-)
Have fun
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Packs

  • Sr. Member
  • ****
  • Posts: 416
Re: Migrate vb.net to Lazarus
« Reply #2 on: January 19, 2025, 08:39:43 am »
Thank you 🙏.

I am not getting you obey convention in c language means

Packs

  • Sr. Member
  • ****
  • Posts: 416
Re: Migrate vb.net to Lazarus
« Reply #3 on: January 19, 2025, 08:46:55 am »
C# code returning dataset....

How to use same dataset in freepascal.

If I create dll into stand c language type then how to return dataset.

C# function also accept dataset

cdbc

  • Hero Member
  • *****
  • Posts: 1806
    • http://www.cdbc.dk
Re: Migrate vb.net to Lazarus
« Reply #4 on: January 19, 2025, 09:11:01 am »
Hi
You have to come up with a common data-format, that both C# and FPC understands.
AFAICS Anders took the 'ClientDataset' idea from Delphi and implemented it in C#, 'cause there are a lot of similarities... Then so did we in 'TBufDataset', but being alike is a far cry from being able to talk to or understand each other...
You can try to go the route over the interfaces the C# supports and implement them, to try and talk directly to the 'Dataset-Provider' inside the C# code...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

cdbc

  • Hero Member
  • *****
  • Posts: 1806
    • http://www.cdbc.dk
Re: Migrate vb.net to Lazarus
« Reply #5 on: January 19, 2025, 09:14:40 am »
...or maybe try ODBC / ADO connections?!?
/bc
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Packs

  • Sr. Member
  • ****
  • Posts: 416
Re: Migrate vb.net to Lazarus
« Reply #6 on: January 19, 2025, 11:14:06 am »
In this case I have to modify c# code to make it compatible with Lazarus dataset

gidesa

  • Full Member
  • ***
  • Posts: 158
Re: Migrate vb.net to Lazarus
« Reply #7 on: January 19, 2025, 02:50:02 pm »
In this case I have to modify c# code to make it compatible with Lazarus dataset

If your application will run on Windows, you can create a C# COM/Activex library.
So you can export quite complex objects, not simple functions as with C API conventions.
Then import the Activex Dll in Lazarus using menu Tools/Import type library.

Edson

  • Hero Member
  • *****
  • Posts: 1321
Re: Migrate vb.net to Lazarus
« Reply #8 on: January 23, 2025, 06:00:58 pm »
FAIK there isn't compatible object for the Dataset of .Net in FPC. That's a high level object and don't think can be easily replaced.

I'd suggest to replace the Dataset for a serialized version, maybe a JSON, so you can pass it to the front-end as a simple text.

Every data exchange between the front-end and back-end should be done in a standard format like XML or JSON, due to the incompatibility of the systems.

Thinking more in architecture. I would replace all the back-end in a simple executable file or dll, that should be controlled by the front-end.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Packs

  • Sr. Member
  • ****
  • Posts: 416
Re: Migrate vb.net to Lazarus
« Reply #9 on: January 23, 2025, 06:16:35 pm »
You are correct.

It is really big ERP application.

If start to migrate to api it will take time and issues.

So I thought Keep c# I will keep and front end Lazarus.

Or I have migrate to c# front end and use third party component


 

TinyPortal © 2005-2018