StrongLoop Labs</figure> </div>

This project provides early access to advanced or experimental functionality. It may lack usability, completeness, documentation, and robustness, and may be outdated.

However, StrongLoop supports this project. Community users, please report bugs on GitHub.

For more information, see StrongLoop Labs. </div>

Page Contents


Xamarin enables you to create iOS, Android, and Windows mobile client apps from a single C# codebase.

The LoopBack Xamarin SDK includes a tool that creates a Xamarin C# client API based on a LoopBack server backend API. The client API has a standard set of CRUD methods.  In addition, relation methods and custom remote methods in your LoopBack API are generated by the tool as a corresponding C# API. These are documented in Xamarin client API.

Non-public Information
So, for example, if there’s an inner model called “Email” that hasn’t been defined as public in loopback’s model-config.json, you can’t write custom methods that return an Email model, simply because the SDK is not privy to it, it doesn’t know there is such a model.</div>


Get the SDK from GitHub:

$ git clone

A sample application is at

Folders Overview

The SDK has the following folders:

  • C# - Source code for the C# part of the generator and testers for the entire generator
    • The open-source of the C# part of the generator, accessed by LBXamarinSDK.sln. This project’s end result is LBXamarinSDKGenerator.dll that is placed automatically as a post-build event inside the bin directory. 
  • bin - contains the lb-xm CLI tool.
  • examples - contains a LoopBack server and a Xamarin solution of an Android app using the SDK, and a second LoopBack server and a Visual Studio solution of a console application using the SDK.
  • lib
  • test-server -  testers for the lb-xm end result that the Testers act upon.

If you need only a functional SDK generator without source code or examples, you need only the folders lib, bin and the files in the root directory.

Using the SDK generator

Set up

On Windows or MacOS:

$ cd loopback-sdk-xamarin
$ npm install

Generating a Xamarin API

To create a Xamarin client based on a LoopBack API:

  1. Create C# code for the SDK; for example:

    $ cd bin
    $ node lb-xm d:/your-server-app/server/server.js

    Where d:/your-server-app/server/server.js is the full path to your LoopBack application main server script.

    The above command shows an example of running the command directly from the lbxamarinsdk-generator/bin directory. If you were running the command from another directory, you would instead use (for example):

    $ node d:/loopback-sdk-xamarin/bin/lb-xm d:/your-server-app/server/server.js
  1. The generator will save its output in a directory it creates called output, in the directory where you run the lb-xm command. 

lb-xm command

Use the lb-xm command to generate a Loopback client in C# based on a LoopBack server API.

The general syntax (when running it in the lbxamarinsdk-generator/bin directory) is:

node lb-xm path-to-server-script [options]



Full absolute path to the LoopBack application main script. In the standard project layout<_app-dir_>/server/server.js. Required. 


You can provide one or more of the following options:

**dll**    Compile a dll containing the SDK

**forms**    Ensure compatibility with Xamarin-Forms

**force**    Remove unsupported functions

**check**    Check if the SDK compiles successfully as C# code

For example, the following command generates a C# (.cs) file:

$ node lb-xm c:/testServer/server/server.js

The following command generates a compiled DLL:

$ node lb-xm c:/testServer/server/server.js dll

The command saves the result in the bin/output folder.