SelfServicing: copy data to another database

Posts   
 
    
JayBee
User
Posts: 280
Joined: 28-Dec-2006
# Posted on: 07-Jul-2020 15:48:42   

Hi,

I've got the same application with a SQL Server database running on two different locations. Now I've got to copy / move some data (related records from different tables) from one location to the other. What is the easiest way to do this? WCF, Remoting, (SOAP )Webservices, ....

One of the application servers is a Windows 2003 Server. So the solution will have to work with dotnet 4.0.

Best regards,

Jan

Walaa avatar
Walaa
Support Team
Posts: 14986
Joined: 21-Aug-2005
# Posted on: 08-Jul-2020 09:52:43   

This is more of an architecture question, and not related to LLBLGen Pro, right? Is this a one time migration job? Or a continuous synching job? As this can be carried over on the Database Level, if you are talking about the easiest way.

JayBee
User
Posts: 280
Joined: 28-Dec-2006
# Posted on: 08-Jul-2020 12:19:21   

Hi Walaa,

You could qualify this as an architecture question.

It is something that is triggered by an enduser. A certain amount of work was initially allocated to a factory and then has to be reallocated to another factory. Both factories have there own application servers and database servers on separate networks, but a connection can be made. I am investigating different ways to get the associated data from one database into the other. I am considering using System.Net.Sockets and the binary serialization capabilities of LLBLGen.

Walaa avatar
Walaa
Support Team
Posts: 14986
Joined: 21-Aug-2005
# Posted on: 08-Jul-2020 22:37:29   

As far as I know ASP. NET 4 has support for Web API 2. Which I think is better to use in your case instead of sockets.

On another note, I'm not sure if you need to copy entity graphs or it's just entities from one table. In the former case you need to look for Deep Cloning in the forum. Either way you will need to clear the PK/FKs, and mark the entity as new and the fields as changed.

In all cases, please let us know if you face any problems copying entities.

JayBee
User
Posts: 280
Joined: 28-Dec-2006
# Posted on: 09-Jul-2020 08:28:06   

I have to copy an entity graph. Most of the stuff I buiild is still using webforms. I think I am going to make a SOAP service. It is straight forward and still supported in higher levels of asp.net framework.

It is not going to be a straight forward copy. E.g. I have to take into account that the factory to which is has been reallocated might allocate it to the factory to which it was originally allocated. I found some T-SQL that creates POCO objects from a database scheme and will use that as a base.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39763
Joined: 17-Aug-2003
# Posted on: 09-Jul-2020 09:44:53   

moving data from one place to the other is the fastest if there's the least amount of serialization. If this is a one-time thing, you could export data from sqlserver and import it again using SMSS.

If you're running on .net fx, you can try binary serialization, it's very fast in our framework. It's often scoffed at but it can help a lot. Running on .net core, you're likely needing to go the json route. also if it's a service which is publicly accessible, it might be a good idea to implement a webapi indeed.

a soap service is old hat, you can either do a WCF service or webapi, the latter is also available on .net core. Project your data to DTOs (e.g. using a derived model created in the designer using the generated code, return the data from the webapi (so you can protect it with e.g. oauth) and write it back to the database on the other side with the generated persistence code for the dto derived models.

Frans Bouma | Lead developer LLBLGen Pro
JayBee
User
Posts: 280
Joined: 28-Dec-2006
# Posted on: 09-Jul-2020 10:38:12   

Hi Otis,

I am old hatsmile Near retirement.

Running in .net fx. if I go for the binary serialization what technology would you suggest? Sockets?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39763
Joined: 17-Aug-2003
# Posted on: 09-Jul-2020 11:54:52   

smile

'Remoting' it's called. But again, be aware that if it's a public facing API, it's not going to be secure.

Frans Bouma | Lead developer LLBLGen Pro