DA PCL Async Problem

Hi,

Recently started using DA.Net for cross platform projects.

I’m using the Portable Class Library w/ DA LINQ, and everything needs to be Async.

My problem is that when i try to run a Query, the NeedsLogin kicks in but since the login is ALSO async, the query always fails with “Session not found”. Been searching for a sample but no luck.

Any ideas!!..please advice.

Regards.

Hello.

Thank you for the report. We are investigating this problem at the moment. We will inform you when we find a solution.

Thanks

Hello.

To solve the problem please handle client’s channel OnLoginNeeded event as follows:

    void fClientChannel_OnLoginNeeded(object sender, LoginNeededEventArgs e)
    {
        var res = LogOnAsync(user, password).Result;
        e.Retry = res;
        e.LoginSuccessful = res;
    }

In this async version for logon will be as follows:

    public Task<Boolean> LogOnAsync(String userId, String password)
    {
        return (new RemObjects.DataAbstract.Server.BaseLoginService_AsyncProxy(this.fMessage, this.fClientChannel, "LoginService")).LoginExAsync(String.Format(DataModule.ConnectionString, userId, password));
    }

After these changes client will log in before get data.

Thanks

Hi,

Thanks for the reply. I tried this approach but i am getting the following error:

Error CS1061: Type RemObjects.DataAbstract.Server.BaseLoginService_AsyncProxy' does not contain a definition forLoginExAsync’ and no extension method LoginExAsync' of typeRemObjects.DataAbstract.Server.BaseLoginService_AsyncProxy’ could be found.

Regards,

Hello.

Please add RemObjects.DataAbstract to uses. This namespace is needed to allow compiler to resolve the extension method LoginExAsync.

Thanks

Hi,

I am using it. Here is my entire using block:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RemObjects.SDK;
using RemObjects.DataAbstract;
using RemObjects.DataAbstract.Linq;

Hello.

Please check RemObjects.DataAbstract.Async assembly in the references. Add it manually if it is not placed here. This assembly contains LoginExAsync extension method implementation.

Thanks

Hi,

I do not have that dll.

I’m runing “RemObjects+Data+Abstract+for+.NET±+7.0.75.1117”.

Btw, i am using Xamarin but anyway i don’t see that ‘RemObjects.DataAbstract.Async.dll’ in my installation, not in the PortableClassLibrary forlder or the .NET Folder or any of the Mono(xxx) folders.

Regards,

Hello.

Sorry for the misunderstanding you. This extension method was added after Spring 2014 release. Please add the next LoginExAsync implementation into your code

    public Task<Boolean> LogOnAsync(String userId, String password)
    {
        return this.LoginExAsync(String.Format(DataModule.ConnectionString, userId, password));
    }

    public Task<Boolean> LoginExAsync(String loginString)
    {
        RemObjects.DataAbstract.Server.IBaseLoginService_Async lAsyncService
            = (new RemObjects.DataAbstract.Server.BaseLoginService_AsyncProxy(this.fMessage, this.fClientChannel, "LoginService"));
        return Task<Boolean>.Factory.FromAsync<String>(lAsyncService.BeginLoginEx, lAsyncService.EndLoginEx, loginString, null);
    }

Thanks