Plugin.Firebase.Firestore 2.0.7

dotnet add package Plugin.Firebase.Firestore --version 2.0.7
NuGet\Install-Package Plugin.Firebase.Firestore -Version 2.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Firebase.Firestore" Version="2.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Plugin.Firebase.Firestore --version 2.0.7
#r "nuget: Plugin.Firebase.Firestore, 2.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Plugin.Firebase.Firestore as a Cake Addin
#addin nuget:?package=Plugin.Firebase.Firestore&version=2.0.7

// Install Plugin.Firebase.Firestore as a Cake Tool
#tool nuget:?package=Plugin.Firebase.Firestore&version=2.0.7

Firestore

Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud. Like Firebase Realtime Database, it keeps your data in sync across client apps through realtime listeners and offers offline support for mobile and web so you can build responsive apps that work regardless of network latency or Internet connectivity. Cloud Firestore also offers seamless integration with other Firebase and Google Cloud products, including Cloud Functions.

Installation

Nuget

NuGet

Install-Package Plugin.Firebase.Firestore

Setup

Usage

To be able to fetch your data from the firestore, you'll need to create a POCO that implements the IFirestoreObject interface. Use the FirestoreDocumentId and FirestoreProperty attributes to hook up its properties, for example:


public sealed class Pokemon : IFirestoreObject
{
    [FirestoreDocumentId]
    public string Id { get; private set; }

    [FirestoreProperty("name")]
    public string Name { get; private set; }

    [FirestoreProperty("weight_in_kg")]
    public double WeightInKg { get; private set; }

    [FirestoreProperty("height_in_cm")]
    public float HeightInCm { get; private set; }

    [FirestoreProperty("sighting_count")]
    public long SightingCount { get; private set; }

    [FirestoreProperty("is_from_first_generation")]
    public bool IsFromFirstGeneration { get; private set; }

    [FirestoreProperty("poke_type")]
    public PokeType PokeType { get; private set; }

    [FirestoreProperty("moves")]
    public IList<string> Moves { get; private set; }
    
    [FirestoreProperty("first_sighting_location")]
    public SightingLocation FirstSightingLocation { get; private set; }

    [FirestoreProperty("items")]
    public IList<SimpleItem> Items { get; private set; }

    [FirestoreProperty("creation_date")]
    public DateTimeOffset CreationDate { get; private set; }

    [FirestoreServerTimestamp("server_timestamp")]
    public DateTimeOffset ServerTimestamp { get; private set; }

    [FirestoreProperty("original_reference")]
    public IDocumentReference OriginalReference { get; private set; }

}

This class is represented in firestore like this:

firestore_poco.png

Further information

Take a look at the documentation for the Xamarin.Firebase.iOS.CloudFirestore packages, because Plugin.Firebase's code is abstracted but still very similar.

Since code should be documenting itself you can also take a look at the following classes:

Release notes

  • Version 2.0.7
    • Fixed missing DateTime in firestore (PR #280)
    • Fix simple number arrays on firestore android (issue #276)
  • Version 2.0.6
    • Support int properties on IFirestoreObjects on Android (PR #247)
    • Firestore plugin converts NSNumbers to nullable .NET types (e.g. float?, int?, long?) (PR #250)
  • Version 2.0.5
    • Bumped up Xamarin.Firebase.Firestore package to version 124.8.1.1
  • Version 2.0.4
    • Firestore CollectionReference inherits Query (PR #205)
    • Adding GetCollectionGroup to FirebaseFirestore (PR #207)
    • Adding synchronous versions of WriteBatch.Commit() (PR #208)
    • Added the Parent property to CollectionReference. (PR #209)
  • Version 2.0.3
    • Use Debug.WriteLine() in object extensions (issue #174)
  • Version 2.0.2
    • re-add tohashmap extension for firestore setdataasync method when data is a dictionary of objects
    • fix firestore setdataasync for ios
  • Version 2.0.1
    • Remove unnecessary UseMaui property from csproj files
    • Readd net6.0 tfm
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-android31.0 is compatible.  net6.0-ios was computed.  net6.0-ios16.1 is compatible.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Plugin.Firebase.Firestore:

Package Downloads
Plugin.Firebase

The plugin includes cross-platform APIs for Firebase Analytics, Auth, Cloud Messaging, Crashlytics, Dynamic Links, Firestore, Cloud Functions, Remote Config and Storage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.7 2,843 3/29/2024
2.0.6 11,433 1/13/2024
2.0.5 7,475 11/14/2023
2.0.4 5,415 10/18/2023
2.0.3 14,030 7/20/2023
2.0.2 17,294 4/11/2023
2.0.1 1,498 3/31/2023
2.0.0 2,327 3/26/2023