.NET linq access to DA table with parameters

Is there a way to add parameters to a LINQ DA call

I have .NET code to fetch data from a dataabstract server
var query = dataAdapter.GetTable<OffCloudClient.dadata.RelatieNxN>()
.Where(x => x.rel_type ==OffCloudClient.dadata.RelatieNxN.reltypeProductGroep);

However the daschema has 2 parameters (used by existing delphi code)
Calling above code throws an error because the parameters aren’t specified.
image

How can I add the parameters at client side?

Hi,

from c# - query entity with linq passing in two parameters - Stack Overflow , you can use both parameters like

var query = dataAdapter.GetTable<OffCloudClient.dadata.RelatieNxN>()
      .Where(x => x.rel_opties == value &&
                  x.rel_type == OffCloudClient.dadata.RelatieNxN.reltypeProductGroep);

Hmm, I am not talking about fields, I am talking about DA parameters.
How can these be specified on client side?

Hi,

you can use this method:

public virtual RemoteTableQuery<T> GetTable<T>(DataParameter[] parameters);

like

DataParameter[] queryParameters = new DataParameter[2] {
                                       new DataParameter("p1", 1),
                                       new DataParameter("p2", 2)};                
var query = from x in dataModule.DataAdapter.GetTable<Agents>(queryParameters) select x;
1 Like

Works, thanks
FYI: I search in .daConfig File before asking a question here but I usually don’t find an answer.
Is there a better way?

image

Hi,

try to simplify request like linq:

FWIW, search with spoace sis fine too, egh “linq adapter” finds results, its just that the specific string “linq variables:” did now. As a spearte note, there seems to be a purely visual bug that after searching, the HTTP-encoded spaces show badly as %20. This does not negatiovely afftect the success of the search – but i’ll try and get that fixed.