Automatic CRUD operations

Is there a way to generate server mthods to do CRUD operations on certain table (entity) ? and how to connect them with dbnavigator and dbgrid ?

You can use XData here. It will automatically create CRUD operations (on a REST server) for your Aurelius entities.

On the client side, query data from your XDataServer using a TXDataClient and attach the result to an TAureliusDataSet. Than use the DataSet as any other DataSet.

HTH,

1 Like

you mean TXDataWebClient ? any demo about this ?

I created the XData server CRUD endpoints but I just wonder instead of writing server methods one by one to generate them ?

You can do both. There are demos in folder \xdata\demos\web that shows integration with TMS Web Core.

I dont have web core subscription. I need to know how to generate server methods for windows client.

If you're building a TMS WebCore app, than yes. If it is a plain VCL/FMX app than NO. Just TXDataClient class.

XData will automatically create CRUD endpoints to all your Entities (in XData model)

Regards,

Any resources or video to read about this ?

Any entity objects you get with TXDataClient can be put in a TAureliusDataset which in turn can be bound to data-aware controls.

Sorry want to understand more please.

I found this demo "XDataFiredacSQL" that has server and client. I see in this demo a service created for customer to have server methods to do CRUD

procedure CreateCustomer(Customer: TCustomer);
function GetCustomers: TList<TCustomer>;
function GetCustomer(Id: Integer): TCustomer;
procedure UpdateCustomer(Id: Integer; Customer: TCustomer);
procedure DeleteCustomer(Id: Integer);

So I have to write those methods myself , they can not be generated automatically ?

sorry again

You can create your own CRUD operations with XData --or-- you can use the ones created automatically.

Have a look at simple_sqlite in XData\Demos folder.

A simple demo with automatically created CRUD for entities declared in Common\AureliusEntities.pas

Regards,

2 Likes

Why would you want XData to generate those automatically for you, if it can create the automatic CRUD endpoints with are even more straightforward?

I am trying to understand different ways to work with XData. Can you please refer me to documentation to read more about it.

The Automatic CRUD endpoints are described here: TMS Aurelius CRUD Endpoints | TMS XData documentation.

There is this video showing the CRUD endpoints: From Database to Web App through REST server with TMS XData and TMS Web Core - YouTube

1 Like

I see only server code I dont see the client how it connect or perform.

I watched the video but I dont have webdatasource component so I used TDataSource and connected to XDataWebDataSet1. XDataWebConnection1 is also connected but no data displayed in dbgrid.

Have a look at JwtAuthDemo in XData\Demos folder. There's a server and client showing exactly what you want.

Also, have a look at firedac-sql in XData\Demos

HTH

2 Likes

Many thanks now I understand that I can use entities or create and call server methods.

This video also is great

2 Likes

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.