Platform considerations

Siaqodb assemblies are platform independent, however projects require platform specific LMDB binaries. If you use the Nuget packages, those binaries will be automatically placed into your /bin folder and no action is required. If you manually reference Siaqodb assemblies on Windows based platforms, be sure you copy in your /bin folder also LMDB native binaries for each platform you target.

Requirements for your App project

(if the project is a library, this step is not required).

  • Universal Windows Platform (UWP) apps: In Visual Studio, besides Siaqodb dlls, you have to add as reference 'Microsoft Visual C++ 2013 Runtime Package for Windows'. Do this by Add Reference, Universal Windows, Extensions and check: Microsoft Visual C++ 2013 Runtime Package for Windows Universal. Be aware that once you've added this reference, you will have to build the project for a specific platform (ARM/x86/x64); 'Any CPU' does not work.

  • WindowsStore apps: In Visual Studio, besides Siaqodb dlls, you have to add as reference 'Microsoft Visual C++ 2013 Runtime Package for Windows'. Do this by Add Reference, Windows 8.1, Extensions and check: Microsoft Visual C++ 2013 Runtime Package for Windows. Be aware that once you've added this reference, you will have to build the project for a specific platform (ARM/x86/x64); 'Any CPU' does not work.

  • WindowsPhone apps: In Visual Studio, besides Siaqodb dlls, you have to add as reference 'Microsoft Visual C++ 2013 Runtime Package for Windows Phone'. Do this by: Add Reference, Windows Phone 8.1, Extensions and check: Microsoft Visual C++ 2013 Runtime Package for Windows Phone. Be aware that once you've added this reference, you will have to build the project for a specific platform (ARM/x86); 'Any CPU' does not work.

  • Xamarin: There is a great Siaqodb Xamarin example available for you to download from Github.

  • Xamarin.iOS:

    • In XamarinStudio, besides Siaqodb dlls references, you have to add also native lmdb binaries. So right click on project, Add Native Reference, pick /bin/native/ios/simulator/liblmdb.a (or /device/liblmdb.a) and GO.

    • In Visual Studio, besides Siaqodb dlls references, you have to add also lmdb binaries, so:

      • Copy /bin/native/ios/simulator/liblmdb.a (or /device/liblmdb.a) in your Xamarin.iOS project folder (where your csproj file resides)

      • Edit csproj file in Text editor(eq: Notepad) and search for the ItemGroup tag where your cs files are added and add the following Item into that group:

<EmbeddedResource Include="liblmdb.a">
    <Link>liblmdb.a</Link>
    <LogicalName>liblmdb.a</LogicalName>
</EmbeddedResource>

So the complete ItemGroup may look like this:

<ItemGroup>
    <Compile Include="Main.cs" />
    <Compile Include="AppDelegate.cs" />
    <None Include="Entitlements.plist" />
    <None Include="Info.plist" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <ITunesArtwork Include="iTunesArtwork" />
    <ITunesArtwork Include="iTunesArtwork@2x" />
    <EmbeddedResource Include="liblmdb.a">
      <Link>liblmdb.a</Link>
      <LogicalName>liblmdb.a</LogicalName>
    </EmbeddedResource>
    <None Include="packages.config" />
  </ItemGroup>

Edit AssemblyInfo.cs and add this line for the Simulator:

[assembly: LinkWith("liblmdb.a", LinkTarget.Simulator, Frameworks = "Foundation", ForceLoad = true)] 

OR for a device

[assembly: LinkWith("liblmdb.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Arm64, Frameworks = "Foundation", ForceLoad = true)] 
  • Xamarin.Android: LMDB native binaries are embedded into Siaqodb.dll so no additional steps are required.

  • MonoMac(open source) or Xamarin.Mac: In XamarinStudio, besides the Siaqodb dlls references, you have to also add native LMDB binaries. Right click on the project, Add Native Reference, pick /bin/native/MacOSX/liblmdb.dylib and GO.

Requirements for Unity3D projects

Important for all Unity3D platforms: Persistent types must be defined in a separate assembly (see GameEntities project example), not directly in Unity3d project. The reason is that Unity3D builds an assembly dynamically at every run for your C# classes/scripts and its name is different at every run. Since Siaqodb stores full namespace names where entities reside (to be able to re-build objects back), it is necessary that you have a separate assembly for your persistent entities so that their names are also persistent.

  • Windows:

    To run Siaqodb on Windows, you will have to copy file from /binaries/windows/ (Siaqodb.dll, lmdb32.dll and lmdb64.dll) to any /Assets/ subfolder, usually where your scripts are located or within /Assets/Plugins/ folder.

    • You can quickly test it by opening Unity3D project /SiaqodbUnityDemo within setup package:

      • Go to File->Open Project...-> select /SiaqodbUnityDemo folder from package
      • Copy all 3 files Siaqodb.dll, lmdb32.dll and lmdb64.dll from /binaries/windows/ into Assets/Siaqodb/ folder.
      • Go to GameObject->CreateEmpty
      • Drag from Project explorer DemoRunner and drop over the empty GameObject.
      • Hit 'Play', the Game Simulator will run and result will be displayed to the Console.
  • WindowsStore:

    To run Siaqodb on WindowsStore/WindowsPhone, you will have to copy file from /binaries/winstore-winphone/ (Siaqodb.dll, lmdb.dll) to any /Assets/ subfolder, usually where your scripts are located or within /Assets/Plugins/ folder.

    • You can quickly test it by opening Unity3D project /SiaqodbUnityDemo within setup package:

      • Go to File->Open Project...-> select /SiaqodbUnityDemo folder from package
      • Copy files Siaqodb.dll and /native/platform/lmdb.dll(for ARM/x86/x64 ) from /binaries/winstore-winphone/ into Assets/Siaqodb/ folder.
      • Go to GameObject->CreateEmpty
      • Drag from Project explorer DemoRunner and drop over the empty GameObject.
      • Go to File-> Build Settings..->Select WindowsStore as platform->Select SDK(8.1,Phone 8.1 or Universal)-> Build and Run.
  • Mac OSX:

    To run Siaqodb on Mac OSX, you will have to copy file from /binaries/mac-osx/ (Siaqodb.dll and lmdb.bundle) to any /Assets/ subfolder, usually where your scripts are located or within /Assets/Plugins/ folder.

    • You can quickly test it by opening Unity3D project /SiaqodbUnityDemo within setup package:

      • Go to File->Open Project...-> select /SiaqodbUnityDemo folder from package
      • Copy Siaqodb.dll and lmdb.bundle from /binaries/mac-osx/ into Assets/Siaqodb/ folder.
      • Go to GameObject->CreateEmpty
      • Drag from Project explorer DemoRunner and drop over the empty GameObject.
      • Hit 'Play', the Game Simulator will run and result will be displayed to the Console.
  • iOS:

    To run Siaqodb on iOS, you will have to copy file from /binaries/ios/ (Siaqodb.dll and liblmdb.) to any /Assets/ subfolder, usually where your scripts are located or within /Assets/Plugins/ folder.

    • You can quickly test it by opening Unity3D project /SiaqodbUnityDemo within setup package:

      • Go to File->Open Project...-> select /SiaqodbUnityDemo folder from package
      • Copy Siaqodb.dll and copy all files /native/device or native/simulator -depends on what you target- from /binaries/ios/ into Assets/Siaqodb/ folder.
        Note: for XCode 8 or later, you will need to use the FAT library in the native/fat folder.
      • Go to GameObject->CreateEmpty
      • Drag from Project explorer DemoRunner and drop over the empty GameObject.
      • Go to File-> Build Settings..->Select iOS as platform->Player Settings->Select DeviceSDK or SimulatorSDK-> Build and Run.
    Note: For XCode version 8 or greater, you will need to disable Bitcode (XCode -> Project Build Settings -> Enable Bitcode set to No). To do this within Unity please follow instructions here.
  • Android:

    To run Siaqodb on Android, you will have to copy file /binaries/android/Siaqodb.dll to any /Assets/ subfolder, usually where your scripts are located or within /Assets/Plugins/ folder. Then create folder /Assets/Plugin/Android/libs within you project and copy both sub-folders(armeabi-v7a and x86) from /binaries/android/native/ into it.

    • You can quickly test it by opening Unity3D project /SiaqodbUnityDemo within setup package:

      • Go to File->Open Project...-> select /SiaqodbUnityDemo folder from package
      • Copy Siaqodb.dll into Assets/Siaqodb/ folder, then create folder /Assets/Plugin/Android/libs within you project and copy both sub-folders(armeabi-v7a and x86) from /binaries/android/native/ into it.
      • Go to GameObject->CreateEmpty
      • Drag from Project explorer DemoRunner and drop over the empty GameObject.
      • Go to File-> Build Settings..->Select Android as platform-> Build and Run.
Note: Your project may target multiple platforms and each platform will need its own Siaqodb DLL in order to run. To avoid an error message An assembly 'Siaqodb' with the same identity has already been imported. Consider removing one of the references., you need to select the properties of the DLL and select the platform settings (e.g. Windows, Mac OS X and so forth). Simply ensure that only the platform for which the DLL was intended is checked.