DataAbstract iOS 64 bits and monotouch

Hi,

I rely heavily on Relativity and DataAbstract for all my mobile apps but i use Xamarin, and in the process of converting my apps to 64 bits i run into the problem that the DataAbstract.dll references ‘monotuch.dll’ witch is not supported for 64 bits.

Do yo have plans for an update?? Please advice this is a bummer!!!

:cold_sweat:

Hello

Please take a look at this announcement: http://blogs.remobjects.com/blogs/antonk/2014/06/26/p6859 :
"
To start with, the Xamarin iOS and Android platforms are now supported via Data Abstract for the Portable Class Library. This means that there is no more separate Data Abstract for MonoAndroid or MonoTouch builds.

On the bright side, this means that both target platforms now share the same set of features and, due to the PCL support, development of code shared between iOS and Android targets becomes a little easier. There are, however, some caveats you should be aware of:

  • Only DA LINQ data access is supported, DataSet support on the iOS side is not available anymore, so a data access code revamp is needed.
  • Only the simple HTTP client channel is available in Data Abstract for PCL. While this might look restricting, it is still the best choice for apps targeting mobile devices operating with a potentially unstable connection. In such conditions, SuperHTTP has no considerable advantage over the simple HTTP client channel.
  • Only asynchronous server calls are possible. While this is a must in the mobile world due to unpredictable network delays, it can be a real headache when the Begin/End asynchronous calls pattern is used, especially when several remote calls are chained in the same method. Luckily, starting this release, RemObjects SDK for .NET now provides support for async/await remote calls
    "

Also please take a look at this article: http://blogs.remobjects.com/blogs/antonk/2014/07/31/p6917
Similar approach can be used to recreate TCP or synchronous HTTP client channels.

Theoretically it is also possible to modify the references in the sources shipped with Data Abstract and to use self-rebuilt SDK/MonoTouch and DA/MonoTouch assemblies, however we obviously haven’t tested such builds.

Regards

Hi,

Thanks a lot for the info.

I’ve came across this before, trying to us the PCL libraries, but could not find any sample code or documentation on how to start.

Do you know of a sample project of code snippet on how to:

1-) Setup the connection to a Relativity Server
2-) Login using the new Async API
3-) Define the LINQ Data Class
3-) Fetch a Table using the LINQ

Regard,

Temis

  1. Create a new application

  2. Add a new Portable Class Library to the solution. Name it DataAccessLayer. The following steps should be applied to this class library project.

  3. Reference all assemblies from the folder …\RemObjects Software\Data Abstract for .NET\Bin\PortableLibrary

  4. Add the following class to the project:

     using DataAccssLayer.PCTrade;
     using RemObjects.DataAbstract.Linq;
     using System;
     using System.Linq;
     using System.Collections.Generic;
     using System.Threading.Tasks;
     using RemObjects.SDK;
     using RemObjects.DataAbstract;
     using RemObjects.DataAbstract.Server;
     
     namespace DataAccessLayer
     {
         public class Engine
         {
             private LinqRemoteDataAdapter _adapter;
     
             public Engine()
             {
                 var clientChannel = new WinInetHttpClientChannel { TargetUrl = @"http://192.168.180.143:7099/bin" };
                 var message = new BinMessage ();
                 var remoteService = new RemoteService (message, clientChannel, true , "DataService" );
                 var streamer = new Bin2DataStreamer ();
    
                 this._adapter = new LinqRemoteDataAdapter ();
                 this._adapter.RemoteService = remoteService;
                 this._adapter.DataStreamer = streamer;
             }
    
             public Task< Boolean> LoginAsync( string username, string password)
             {
                 string loginString = String .Format("User=\"{0}\";Password=\"{1}\";Domain=DASamples;Schema=PCTrade" , username.Replace("\"" , "\"\"" ), password.Replace( "\"","\"\"" ));
    
                 var service = new BaseLoginService_AsyncProxy (this ._adapter.RemoteService, "LoginService");
    
                 return service.LoginExAsync(loginString);
             }
    
             public Task LogoutAsync()
             {
                 var service = new BaseLoginService_AsyncProxy (this ._adapter.RemoteService, "LoginService");
    
                 return service.LogoutAsync();
          
         }
     }
    

This code performs Login/Logout operations. Notice that " symblol in the provided username and password is replaced by “”. This allows to properly process username/password pair in case it contains one or more " chars.

5 Select the DataAccessLayer in the Solution Explorer and issue the VS menu command ‘RemObjects SDK’ -> ‘Create Table Definition Classes’.

6 Go thru the Wizard to create the Table Definition classes.

7 The next step it so add a simple data access method:

     public Task< List< Clients>> LoadAllClientsAsync()
    {
        // Please take a look at the thread http://talk.remobjects.com/t/da-linq-support-for-ios-monotouch-xamarin/4044 (especially at its last message).
        // Queires that load ALL fields of the table weren't supported on iOS devices due to a bug(?) in the Xamamrin ExpressionCompiler.
        // This was reported to Xamarin
        // Until this is fixed one would have to manually list all fields he want to retrieve

        var query = from c in this._adapter.GetTable< Clients>() select new Clients { ClientId = c.ClientId, ClientName = c.ClientName, ClientNotes = c.ClientNotes };

        return _adapter.LoadListAsync(query);
    }

8 Reference the class library from the main mobile project, add there 3 buttons (login, logout and load data) and set their Click handlers to something like

    private async void Button_Click( object sender, RoutedEventArgs e)
    {
        this._engine = new Engine();
        var result = await this._engine.LoginAsync( "simple" , "simple" );
        System.Diagnostics. Debug.WriteLine(result);
    }

    private async void Button_Click_1( object sender, RoutedEventArgs e)
    {
        var data = from x in ( await this._engine.LoadAllClientsAsync()) select x.ClientName;
        foreach ( var item in data)
        {
            System.Diagnostics. Debug.WriteLine(item);
        };
    }

    private async void Button_Click_2( object sender, RoutedEventArgs e)
    {
        await this._engine.LogoutAsync();
    }

Login, logout and data access calls here are asynchronous.

Also please take a look at the last message of the DA LINQ support for iOS/MonoTouch/Xamarin thread.

Regards

Excellent thanks, it worked!!!

Just a quick thing, when i use this code ( of course mapping to my own class ), i still got the Xamarin Compiler bug.

var query = from c in this._adapter.GetTable< Clients>() select new Clients { ClientId = c.ClientId, ClientName = c.ClientName, ClientNotes = c.ClientNotes };

        return _adapter.LoadListAsync(query);

So, i noticed that instead of instantiating the concrete class “Clients” i had to use an anonymous class like this:

var query = from c in this._adapter.GetTable< Clients>() select new { c.ClientId,  c.ClientName, c.ClientNotes };

and then convert it to the desired class like this:

var items = _adapter.LoadListAsync(query)

var result = ( from c in items select new Clients { ClientId = c.ClientId, ClientName = c.ClientName, ClientNotes = c.ClientNotes } ).ToList();
        
return result;

Just a small inconvenience but it works. Thanks a lot.