This is a migrated thread and some comments may be shown as answers.

Architecture for Azure + Xamarin?

2 Answers 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Larry
Top achievements
Rank 1
Veteran
Larry asked on 03 Oct 2020, 09:42 PM

I posted the following to the Xamarin forums but am not getting any responses.  Note that I tried to study your real-world example apps but even they seem to be using the now outdated technology? (I also could not get them to compile...getting errors about the NuGet paths being too long even though I extracted the code to my desktop...not super worried about that now though).

................

I'm new to Xamarin and want to create a cross-platform app to replace a click-once WinForms app. I have a Sql Azure database that I want to keep using. But the components to use are beyond confusing. I need local (offline) storage of course. Is Microsoft still supporting Mobile? In what seems to be the right approach, I end up at: "app-service-mobile/app-service-mobile-value-prop" (sorry, as a first-time poster I'm not being allowed to publish the full link). At that location I see: "This content has been retired and may not be updated in the future. The product, service, or technology mentioned in this content is no longer supported." And that article was written on 6/25/2019.
So, what is "today's" approach to using an Azure back-end service (and database) + having offline (temporary) storage? I'm new to Sqlite too (but very well versed in Sql Server). Am I now facing a complete "roll my own" solution?

One note, in case it matters, I don't want to use Entity Framework. Staying low level is fine with me (Sql code, etc.).

2 Answers, 1 is accepted

Sort by
0
Accepted
Lance | Senior Manager Technical Support
Telerik team
answered on 05 Oct 2020, 03:23 PM

Hi Larry,

Yeah, the Android project paths can get pretty long, it is usually the culprit for those errors. For that reason, I usually keep a folder close to C or D drive for my Xamarin projects (e.g. D:\XF\clone project here)

About your question for the Azure Mobile Service, there is some confusion about what part is deprecated and what part isn't. The Azure product "Mobile App Services" is deprecated, instead you just publish your own ASP.NET project as a normal Azure app Service.

The server-side and client-side libraries are actually still valid to use.

  • In your ASP.NET project, you have a controller for each of the DataTables. Those controller inherit from Microsoft.Azure.Mobile.Server's TableController<T> and does all the heavy lifting for you.
  • On the client-side, you use the Microsoft.Azure.Mobile.Client  NuGet package in the Xamarin.Forms project. Then a service class that implements IDataStore<T> (the concrete instance of the interface is wiring up the native platform's Sqlite instance).

Yes, you could not using any of the Azure libraries, but you will need to roll your own API controllers and SQL interactions inside those API controllers. On the client-side you will need to write your own HttpClient services that not only handle authentication, but also local Sqlite offline data sync mechanism in each native platform project.

I'm afraid if you want to avoid Entity Framework Core, you will need to roll your own backend API controllers because the Azure libraries rely heavily on simplifying things by abstracting away the SQL commands (it is rather uncommon to actually make direct SQL calls inside the Xamarin app).

Demos

You'll see that we use this approach in two of our premium samples:

  • Telerik CRM - Uses SQL server via WebAPI in an ASP.NET project with the the Xamarin client-side data libraries. Open that link and see the ArtGalleryCRMService.Forms and ArtGalleryCRMService projects.
  • Telerik ERP -  Open that link and see the /app/ERPApp/ project and the /service/telerikErpService/ project. The client side project uses Microsoft.Azure.Mobile.Client and Microsoft.Azure.Mobile.Client.SQLiteStore, the server uses Microsoft.Azure.Mobile.Server.

If you would like to see a Sqlite client-side only example,

Next Steps

For an example to use as guidance, I recommend cloning and reviewing the ERP app. This is because it has full CRUD implemented, while the CRM is read-only. Follow the instructions in the ERP's README to setup the services and deploy it to your Azure account.

Wrapping Up

Telerik UI for Xamarin does not have technical support services for general data or architectural app development guidance (i.e. it is a suite of UI components). We built those four premium samples to show how you can use the UI components in such a scenario, but the actual data implementation is ultimately up to you. 

I hope I was able to help answer your question, here are two options for further assistance:

  • Telerik Related: If you have any trouble with the Telerik UI for Xamarin controls themselves, please open a Technical Support Ticket here.
  • Data Related: If you do find that you're stuck and need architectural guidance or actual implementation code for the data layer, we do have a services team who will work with you 1:1, contact them here.

Regards,
Lance | Manager Technical Support
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Larry
Top achievements
Rank 1
Veteran
answered on 05 Oct 2020, 05:05 PM
Lots of good information here.  Thanks much!
Tags
General Discussions
Asked by
Larry
Top achievements
Rank 1
Veteran
Answers by
Lance | Senior Manager Technical Support
Telerik team
Larry
Top achievements
Rank 1
Veteran
Share this question
or