Help with net core

net

(DonaldShimoda) #1

Hi,
I need a sample on Oxygene console app net core dataabstract client connecting and consuming data tables (and services methods) from a Delphi server. If don work with net core yet dot care, please help me with standard dot net solution.

I check all the samples for Oxygene and all use net forms, the one don’t use net forms use linq only and need hard datable definition. I try to figure using the way I use in android app and don’t work.

Example:

  1. define http channel, url, message bin, AES encryption.
  2. connect to the data service and get schema (if needed)
  3. open a table of the schema using dynamic where.
  4. browse with for to (?) the items in the table.
  5. update or insert is a plus.
  6. DALINQ way is a plus

Can please share that code?

Best regards.


(marc hoffman) #2

Anton is working on an example for you, but we’ve noticed there’s (unrelated to DA, per se) some issues with .licx processing for .NET Core projects in Elements. We’re working on a fix, but you’ll probably need upcoming Friday’s Elements build do use DA (or any licensed third party components) on .NET Core with Oxygene.


(DonaldShimoda) #3

Great, Thanks!


(DonaldShimoda) #4

Marc, im very pressed to have the project working now, can please send me the beta as you have right now in personal downloads?

Seems like the problem is with every .net projects, not only net core projects. im stopped right now…


(antonk) #5

Do you have the licenses.licx file in your project? Does that file have a proper Build Action ( EmbeddedResource )?


(DonaldShimoda) #6

Thanks Anton! Solved!

Please if you can just give me the sentences needed to connect and get a simple query from my Delphi server schema. I just need right now to connect to the schema query and get the data, only that.

Im connected just can’t figure how to get the records list.

Best regards


(antonk) #7

Issue is that you won’t be able to run it due to that licenses compilation issue.
However I can create a full .NET-targeted console app that will use 100% the same code as the .NET Core would.

For the start let’s cover some basic stuff.

One can build Data Abstract client app in .NET Code using 2 different sets of assemblies - one targeted for .NET Standard and one targeted for .NET Core. Latter one is not available for download yet (will be available in the first post-RTM beta). It will provide access to the same feature set as the desktop .NET-targeted one, including Scripting and DataTable-based data adapter.

Former one (the .NET Standard-based) provides only DA LINQ-based way of data access, mostly because .NET Std is multi-platform and some of these platforms just don’t have DataTable/DataSet classes at all.

DA LINQ by itself is a fairly simple to use thing. To make it easier to start with it let me give a simple explanation how it does work:

  1. There is a set of classes describing server schema (aka Table Definitions)
  2. One writes select queries using fancy code like

var query := from u in dataAdapter.GetTable() where u.Id > 100 select u; // Query definition

and then executes (materializes) that query using

var users := query.ToList(); // Actually execute the query

Another way of writing the same query ans in the 1st line is

var query := dataAdapter.GetTable().Select(u -> u).Where(u -> u.Id > 100);

That’s exactly the same query as in the 1st line, just written in a different form. This latter form is exactly the same in terms of performance, but it is easier to understand what’s going on there and it somewhat resembles “real” SQL:

  1. Take a data source table dataAdapter.GetTable<Users>()
  2. Select data from it ( .Select(... )
  3. Filter that selected data ( .Where(... )

And here’s the sample app (targeting desktop .NET). This app uses sample domain from the Relativity Server as a data source: LinqConsoleApplication.zip (38.0 KB)


(DonaldShimoda) #9

Thanks for the explanation.

So I only can use LINQ and cannot use datable when using dot net? If I can avoid datable definition files I will be happy (I think). Just whant to connect to a schema, put schema table name, open and get the records. Ala Delphi. Is possible? I do in android. Not possible in dot net?

Add that question. How to generate a project as the one you share connecting to a dataabstract server and generating all the data tables definitions with Fire?

Best regards.


(marc hoffman) #10

You can only use DA LINQ, with the .NET Standard libraries (because they target a lowest common denominator). With the .NET Core libraries (which will be not part in the upcoming 9.6 RTM, but available in the next beta after), you can use DataSets, if I understood Anton correctly.