TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
211 stars 49 forks source link

Firestore CollectionReference inherits Query #205

Closed AdamEssenmacher closed 11 months ago

AdamEssenmacher commented 11 months ago

This PR restructures the plugin's Firestore wrappers and interfaces to mirror the shape of the underlying platform SDKs so that developers can take advantage of the inheritance relationship between CollectionReference and Query.

In Firestore, CollectionReference inherits Query, but this plugin's current implementation does not mirror this structure. I'll demonstrate why this is problematic by example.

Imagine you'd like to write an extension method that applies an arbitrary filter to any given Firestore Query:

public static IQuery ContrivedFilter(this IQuery query)
{
  //
}

This extension could not be used on an ICollection.