Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure Project to support DI and enable Nullity #54

Merged
merged 7 commits into from
Nov 9, 2022

Conversation

acupofjose
Copy link
Contributor

@acupofjose acupofjose commented Nov 8, 2022

This pull represents a restructuring of the entire project to support Dependency Injection and Nullability (ref: supabase-community/supabase-csharp#34 and #53). Unfortunately this introduces some breaking API changes.

  • Client is no longer a singleton class.
  • StatelessClient has been removed as Client performs the same essential functions.
  • Table default constructor requires reference to JsonSerializerSettings
  • BaseModel now keeps track of BaseUrl and RequestClientOptions. These are now used in the default (and overridable) BaseModel.Update and BaseModel.Delete methods (as they previously referenced the singleton).
  • All publicly facing classes (that offer functionality) now include an Interface.
  • RequestException is no longer thrown for attempting to update a record that does not exist, instead an empty ModeledResponse is returned.

In reality, not much should affect the developer as most of these classes/methods are only being referenced internally by the Client. The removal of the Singleton aspect may offer some design changes for those leveraging this library by itself (as opposed to using it only in supabase-csharp.)

// What was:
var client = Client.Initialize(baseUrl, options);
var query = await client.Table<User>.Single();

// Becomes:
var client = new Client(baseUrl, options);
var query = await client.Table<User>.Single();

@acupofjose
Copy link
Contributor Author

Fixes #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant