Client Frequently Asked Questions


How can I add a Simple Login to an existing DA project?

This is fairly straight-forward:

  • Open your project's RODL file in the Service Builder,
  • add a new service to your RODL and set it to descend from SimpleLogin or MultiDbLogin (depending on what you need),
  • implement your Login and Logout methods in the newly generated service implementation source. In the simplest case, all you need to do is create a session in Login (after validating credentials, of course), and destroy it on Logout. You can also use a new DA project as reference for filling these methods.
  • On the client, call the new Login service/method. Again, you can use code from a new DA project as a reference or copy the login form over.

How can I perform DA LINQ requests to DataAbstract for Delphi servers?

If your .NET based client need to communicate with Delphi-based DataAbstract server via DA LINQ then you have to set LinqRemoteDataAdapter.UseDynamicWhere to true. This is necessary because DA LINQ feature uses DA SQL by default but DataAbstract for Delphi does not support it.

If LinqRemoteDataAdapter.UseDynamicWhere property is set to true then DataAbstract will try to transform DA LINQ expression into usual select from a table with corresponding Dynamic Select and Dynamic Where conditions. Obviously only DA LINQ expressions based on a single table can be used in this case (ie join statement is not supported).


How can I perform queries that return anonymous types on Silverlight or WindowsPhone7?

DA LINQ queries that return anonymous types like

var q = (from x in ds.DataAdapter.GetTable<Workers>()
            select new { x.WorkerCity, x.WorkerFirstName });

throw System.MethodAccessException exceptions.

This happens because there are Silverlight platform restrictions for such kind of queries because dynamic classes emitted by such queries have visibility level set to internal.

You should explicitly allow access to these classes outside of the Application assembly (provided assembly attributes are for WindowsPhone7 application):

[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("System.Windows")]
[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("System.Core")]
[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("System.Linq")]
[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("RemObjects.DataAbstract.WindowsPhone")]

How to analyse mapping attributes in the DA LINQ table definition classes?

You can easily get access to that attribute in runtime by using reflection.

// Gets the type of the LINQ generated class
Type type = typeof(Worker);

// Gets the properties
System.Reflection.PropertyInfo[] properties = type.GetProperties();
foreach (System.Reflection.PropertyInfo property in properties)
{
   // Gets the DataTypeAttribute
   object[] roDataTypes = property.GetCustomAttributes(typeof(DataTypeAttribute), false);
   if (0 < roDataTypes.GetLength(0))
   {
      RemObjects.DataAbstract.Schema.DataType roDataType =
         ((DataTypeAttribute)roDataTypes[0]).DataType;

      // Finds out if the given field is autoincrement or not
      if (roDataType.Equals(RemObjects.DataAbstract.Schema.DataType.AutoInc) ||
          roDataType.Equals(RemObjects.DataAbstract.Schema.DataType.LargeAutoInc))
      {
         // performs some custom actions...
      }
   }
}

How to use live data during design time, if server requires login?

To perform a login procedure in design time, you can use Get Design-Time Data option from popup menu of a table. This option will allow you to setup your ''LoginService'', choose its login method and provide login parameters.

Another option is to use TRODesigntimeCall component, its advantage that it is no necessary to enter login info each time. For its use you should first add one more TRORemoteService component and specify ServiceName property to point to you login service. Then you add TRODesigntimeCall, and specify a method which it should call for authorization and fill its parameters. After adjustment you can use Make Call option from popup menu of the TRODesigntimeCall component to login.


Is DA SQL available in Silverlight?

This is a very interesting question on which we can answer Yes and No at the same time.

On the one hand you cannot use DA SQL directly. Means you cannot take an usual RemoteDataAdapter and execute there DA SQL request. The reason is in fact that RemoteDataAdapter operates with DataSet and DataTable classes which don't supported by Silverlight. So for working with data in Silverlight you will need to use another approach - DA LINQ.

DA LINQ operates with simple classes that have appropriate mapping to the schema objects. You can think about such classes like about DataTable classes. With DA LINQ you can construct various LINQ expression, execute them and retrieve data into these simple classes.

But on the other hand each DA LINQ request finally will be transformed by Data Abstract into DA SQL request which will be executed on the server.

Therefore, although you can not use DA SQL in Silverlight directly, it is widely used behind the scenes by DA LINQ requests.

Note: If your Silverlight client should communicate with Delphi based DA server you need to set UseDynamicWhere property of the LinqRemoteDataAdapter to True. This is necessary because DataAbstract for Delphi does not support DA SQL so instead of transformation LINQ expression into DA SQL, DataAbstract will try to transform it into usual select form the table restricted with proper Dynamic Select and Dynamic Where. Obviously that only DA LINQ expressions based on single table can be converted into Dynamic Where plus Dynamic Select.


Why .NET client can't connect to Delphi server with http://localhost:port address?

RemObjects DataAbstract .NET client uses IPv6 address which nowadays isn't supported by default in Delphi servers. There are two ways to solve the problem:

  • Edit c:\windows\system32\drivers\etc\hosts file by adding there line:
127.0.0.1       localhost

In this case localhost will be resolved to 127.0.0.1

Please note that administrative privileges are required to edit this file. Also be careful while editing this file - damaging or improper editing of it can make your system unstable.

  • Use http://127.0.0.1:8099 address instead of http://localhost:8099

Why adding custom properties to DA LINQ table definition classes causes server exception?

This happens because DA LINQ tries to retrieve values of such properties from the server. Obviously there are no corresponding fields in the server Schema defined so an exception is raised on the server side.

To avoid this it is necessary to mark custom (ie not generated) public properties added to DA LINQ table definition classes with attribute RemObjects.DataAbstract.Linq.IgnoreProperty. Properties marked with this attribute are during DA LINQ query processing and DataAbstract will not try to retrieve their values from server.