NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices

Thursday, October 21, 2010

NAVmobile HowTo: Consuming Business Objects

I had recently several requests on writing a little bit more about the NAVmobile customization approach from a dev point of view. So I decided to make a short how-to serie in order to illustrate some of the concepts. Most of it can be found in the documentation, but I hope that I will clarify some of the missing points.

NAVmobile provides the mobile developers with mobile object relational mapping API. It can be used by the developers to consume data stored on the device or data stored on remote storage.
The ORM implementation found in NAVmobile is very useful when dealing with standart CRUD operations over local and remote data in terms of business objects. It has certain limiations mainly because of the resource-related limitations found on the mobile devices these days.
It is not intended to provide complete replacement of the standart ADO .NET implementation found in .NET Compct Framework. However, it gives clean and quick way to deal with the CRUD operations and the various logical and tehcnical challenges related to the synchronization of the data. Each CURD operation through the NAVmobile ORM API performs certain behind-the-scene operations over the locally stored data, which allows later the synchronization engine to properly propagate the changes to the remote side ( the ERP ).
The developer can easily go down to the pure SQL level and deal directly with the mobile storage to perform even advanced data operations.

Local Business Objects
NAVmobile provides framework for bi-directrional data synchronization between the device and virtually any remote data storage ( ussually ERPs like Microsoft Dynamics NAV or Microsoft Dynamics AX ). The existnce of local mobile storage allows the application to be used in occatioanlly connected environments where the data is stored on the device and then synchronized when a connection exists. The developer only needs to declare the business objects and then the NAVmobile framework is taking care of the initial mobile storage provisioning, synchronization and other low level technical tasks.
The business objects must be declared in the NAVmobile business object descriptor file (described in the documentation ) and then a correpsonding .NET Compact Framework class must be created.
Let's pretend we have the following business object declaration:

public class Customer:BusinessObjectBase
public string No;
public string Title;
public double CreditBalance;
public double CreditLimit;
If we need to fetch all customers with positive credit blance , we can use the following code:
IList customers = BusinessObjectBase.FetchAll("CreditBalance>0");
foreach(Customer customer in customers)
Creating new customer object is easy as:

Customer customer = new Customer();
customer.Title="My first customer";
and then fetching only one customer by primary key can be done like this:
Customer customer = BusinessObjectBase.Fetch("567");
Updating a customer:
customer.Title="This is not my first customer";

...and then deleting it:

Using this approach the developer can quicky perform CRUD operations over the business objects stored on the mobile device.

Each CRUD operation over the business objects is propagated later through the sync engine to the remote storage ( the ERP ) during the device synchronization session.

Remote Business Objects
Remote business objects can be consumed by using the NAVmobile LiveLinkEngine, which serves as an on-line connection media between the mobile device and the remote storge ( ERP, Microsoft SQL Server , etc. ). This functionality requires the existance of TCP/IP connection between the device and the NAVmobile Services.

Assuming we need to use the same Customer business object from a remote storage , we can use the following code in order to fetch all ther customers:
IList customers = LiveDataLinkService.FetchAll("CreditBalance>0");
foreach(Customer customer in customers)
The FetchAll method will causes the NAVmobile framework to perform invocation of the NAVmobile Services LiveDataLink Web Service in order to fetch the data from the remote sotrage. The data will be dehydrated into the Customer business object collection and ready for local processing.

Addin a new remote customer is easy too:

Customer customer = new Customer();
customer.Title="My first customer";
The Add method will send the customer business object to the server where it will be stored.
We can use similiar approach to fetch one customer:

Customer customer = LiveDataLinkService.Fetch("567");

and then to change and update it:
customer.Title="here somes a new name";

Deleting the customer is also easy:


The ORM module can be used also in the NAVmobile templating engine to quickly build mobile reports diplsayed and printed on the device. Local and remote data can be mixed together in a single report. More on this subject later.


NAVmobile/AXmobile web site

Tuesday, October 19, 2010

Windows Embedded Handheld

Windows Phone 7 turned out to be a pain for the companies, which already invested a lot in mobile solutions based on Windows Mobile especially those positioned in the B2B market. Windows Phone 7 provides appealing UI and great potential for the end user. However it turned out that it is not suitable to target some very important scenarios required when dealing with B2B solutions.

I just found that Microsoft announced new mobile operating system called Windows Embedded Handheld , which is intended to fill the gap between the personal operating system and the requirements found in some of the specific industrial

.... The first such investment will be a new operating system called Windows Embedded Handheld, which will be targeted specifically at the enterprise handheld device market. This new operating system is based on Windows Mobile 6.5 and will use same the familiar development tools (Visual Studio 2008) and SDK as Windows Mobile 6.5 to provide compatibility with the hardware, software and applications used in the enterprise. By building on the Windows Mobile 6.5 platform, Windows Embedded Handheld devices will provide compatibility with existing and future line-of-business (LOB) applications written for Windows Mobile 6.x.

Windows Embedded Handheld will also meet enterprise requirements around integrating with existing IT infrastructure like Microsoft Exchange and SharePoint as well as incorporate the device management and security functionality necessary for enterprise devices. Support for multiple ARM processor types, a wide range of input methods, and several screen sizes and resolutions will make Windows Embedded Handheld a flexible solution to power the wide range of enterprise handheld devices used today.

New features in Windows Embedded Handheld will include Office Mobile 2010 and a support lifecycle to meet the needs of enterprise customers. OEMs will have access to the Windows Embedded Handheld bits by the end of 2010 to start building new solutions.