Xamarin Portable

0

Is it possible in Xamarin, to have a project Xamarin.Android and Xamarion.IOS and have a class class that accesses SQLite and reuses it in these two projects?

How can we call this?

Does anyone have an example?

    
asked by anonymous 18.05.2017 / 23:32

1 answer

0

Yes it is possible.

Today there are two ways to do code sharing on Xamarin.

Portable Projects (will be replaced by .NET Standard) and Shared (SAP).

For your scenario, access to SQLite, in iOS and Android projects you will need to use the concepts, Partial Class for SAP projects or Dependency Injection for Portable projects, this is your preference, requiring small implementations for each platform.

Why is it necessary to have implementations for each platform?

Each platform stores the SQLite file in different Paths, requiring its implementation on each platform, so using these patterns we can share all common code and implement in each platform what is specific.

From a researched you will see implementations and use of these scenarios, including a Xamarin marathon that talks about these SQLite topics and Code Shares via Xamarin.

    
19.05.2017 / 14:57