Is there a way to use RemObjects for database access but maintain the database schemas in the client source?
Our current approach is server side DA schemas but this is a bottleneck for VCS/team development. Development without constant server changes would also mean faster development for us. The data model can be shared client code for example.
I saw a sample which I believed was client code in another post
I do not find these kind of samples in my installed remobjects sample code however.
Where does your code example (see below) come from?
Do you have a fully working example for this?
My main focus is .NET RO client to .NET RO server communication but a solution also allowing delphi RO client is a plus.
var query = from x in dataModule.**DataAdapter.GetTable<Orders>**() select x;
Schema is by definition a server-side entity. It is set of definitions describing how to convert client-sent requests to database queries.
During the development cycle you can either use Relativity Server as data source or create your own custom server application that would load .daSchema file on startup (or even to reload that file every, say, 5 minutes). So the development cycle would look like this:
You change the .daSchema file
You continue to work on the client code
Server app reloads the .daSchema file and uses the updated Schema
Same server can provide data for both .NET and Delphi clients (and even to iOS, Android or Mac clients)
And then go over this tutorial (it accesses a Relativity Server data source from a WinForms application using DA LINQ): ToDo List Tutorial (Windows Forms)
Can you elaborate on this server app reloads the .daSchema?
I found documentation about it here How to Dynamically load DA Schema while server is running? (Delphi Win32) - #7 by scherb
Which class has this LoadFromFile function which I can give a .daSchema?
and how can I access/configure this class from/on my RemObjects.DataAbstract.Server.DataAbstractService?
DataService: The BeforeFindServiceSchema event used to provide custom Schema instance
SchemaWatcher.cs - 2 classes, one reloads Schema if it seems to be changed ( SchemaLoader ), another class is the one that triggers the reload process and provides Schema (either current one or reloaded one) to the data service (‘SchemaProvider’)
var schemaLoader = new SchemaLoader("SchemaAutoReloadDataset.daSchema");
var container = new SimpleContainer();
container.RegisterSDK(server.NetworkServer);
container.RegisterDataAbstract();
container.RegisterSingleton<ISchemaLoader>(schemaLoader);
container.RegisterSingleton<ISchemaProvider, SchemaProvider>();
container.RegisterServices();
server.DependencyResolver = container;
When run, the server app check the “SchemaAutoReloadDataset.daSchema” file for changes and reloads it if needed, deserializes Schema from this file and provides this Schema to the Data Service
I have implemented this and this works.
I have one additional question. Can I generate the strongly typed delphi source files (from commandline) based on the daschema file?
FYI: I don’t see the option in the DA Schema Modeler either
Unit ToolsAPI not found (from uDAClientSchema.pas)
program generatestronglytypeddelphsource;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
uDASchemaUnitsGenerator;
procedure createstronglytypeddelphsource();
var
aSchema:TDAClientSchema;
begin
try
aSchema:=TDAClientSchema.create();
GenerateSchemaUnits(aSchema);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
FYI: Including C:\Program Files (x86)\Embarcadero\Studio\21.0\source\ToolsAPI in the search path gives an error on the DockForm unit (which I do not have on my filesystem)
I cannot build testcase.
When trying to build it complains about firedac and other components I do not have installed.
When I strip the .dproj it still gives a fatal error “Required package ‘ibxpress’ not found”
I do not find this in the dproj or code. I do not find a UserTools.dproj (i thought this might be the cause)
I don’t know where this dependency comes from
I have attached my reduced .dproj
FYI: I am testing on XE10.4.0 Project6.zip (2.0 KB)