Reputation: 1
I'm trying to develop using Xamarin Forms a logistic application that has a central Database which stores data coming from multiple warehouses. I would like to get an offline sync features to my devices only with data related to specific warehouses. (see Jpg)
Is there any framework or sample that I can use as guideline ?
Regards
Upvotes: 0
Views: 4697
Reputation: 1835
Matteo, you could implement a server extension like this
public static class ItemExtensions
{
public static IQueryable<WarehouseItem> WarehouseFilter(this IQueryable<WarehouseItem> query, string WarehouseId)
{
return query.Where(item => item.WarehouseId.Equals(WarehouseId));
}
}
and then implement it as
public IQueryable<WarehouseItem> GetAllWarehouseItems()
{
return Query().WarehouseFilter(WarehouseId);
}
public SingleResult<WarehouseItem> GetWarehouseItem(string id)
{
return new SingleResult<WarehouseItem>(Lookup(id).Queryable.WarehouseFilter(WarehouseId));
}
A great reference for stuff like this is Adrian Hall online tutorial https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure
Hope it helps!
Upvotes: 0
Reputation: 1213
there are a few samples out there:
Xamarin Evolve 2016 App by James Montemagno
Depends on Azure as backend but even if you don't want to use it, it is a good sample to look at.
Todo with sql-database
This doesn't have a backend but is a good example how to use a sqlite-database to store data for offline usage.
Todo Backends
Versions of the Todo App with different backends e.g. Azure, WCF, ASMX, ... but without Offline-Sync
Upvotes: 1