Skip to content

Missing methods in Parse .NET SDK 4.0 #397

@patkozlowski

Description

@patkozlowski

Issue when upgrading to Parse SDK 4.0

After upgrading to Parse SDK 4.0, I've run into a few issues due to changes in the API. Here’s what I’ve encountered:

  1. user.Username is no longer accessible

    • In previous versions, I was able to access the Username field directly with user.Username, but in version 4.0, that field seems to be missing. The following code no longer works:
      var user = ParseClient.Instance.GetCurrentUser();
      if (user.Username == "Test123")
      {
          // logic
      }
  2. user.GetRelation<ParseObject>("SomeClass") is no longer available

    • The method GetRelation<ParseObject>("SomeClass") no longer works. I'm unsure how to handle relations in version 4.0 since it seems like this method was changed or removed. Here’s the code that no longer functions:
      var someClassRelation = user.GetRelation<ParseObject>("SomeClass");
  3. await user.SaveAsync() is no longer working

    • The method SaveAsync() is no longer available on ParseUser objects directly. The following code no longer works:
      await user.SaveAsync();

Environment

  • Parse SDK Version: 4.0
  • Platform: .NET 9.0 MAUI, iOS/Android (or specify your platform)

Any guidance or clarification on these issues would be greatly appreciated! Thanks in advance. Maybe @YBTopaz8 can help? Thanks!

Activity

parse-github-assistant

parse-github-assistant commented on Dec 19, 2024

@parse-github-assistant

Thanks for opening this issue!

YBTopaz8

YBTopaz8 commented on Dec 19, 2024

@YBTopaz8
Member

Hi @patkozlowski
Thank for pointing those out.
Might've missed missed/changed them.
Also, the documentations aren't updated yet, but will be in a few.
Expect a fix today.

mtrezza

mtrezza commented on Dec 20, 2024

@mtrezza
Member

@YBTopaz8 could you please also add the tests for these fixes? It seems these issues were not caught by the CI because of the low test coverage. Thanks to @patkozlowski for reporting, that helps us to improve the coverage.

changed the title [-]Issue when upgrading to Parse SDK 4.0[/-] [+]Missing methods in Parse .NET SDK 4.0[/+] on Dec 20, 2024
YBTopaz8

YBTopaz8 commented on Dec 20, 2024

@YBTopaz8
Member

Absolutely.

I've fixed all issues pointed out (in fact, 2 of 3 were fixed by a PR I was about to do today.)

I fixed the 3 one (an oversight led to an overflow.)

YBTopaz8

YBTopaz8 commented on Dec 20, 2024

@YBTopaz8
Member

Just updating to info that I have fixed tests too so they work.
PR incoming
image

YBTopaz8

YBTopaz8 commented on Dec 21, 2024

@YBTopaz8
Member

Just submitted #402 that clears your issues and any other potential one.
Added actually over 100 tests that should significantly improve coverage.
Starting to get a hang of it.
Good stuff 👍🏾.

@patkozlowski truly appreciate your feedback
image

added a commit that references this issue on Dec 21, 2024
943a0ef
patkozlowski

patkozlowski commented on Dec 25, 2024

@patkozlowski
Author

Thanks for the quick turn around @YBTopaz8, great work!

YBTopaz8

YBTopaz8 commented on Dec 26, 2024

@YBTopaz8
Member

Thanks @patkozlowski

When it will be released, you will be able to use Relations and Pointers as intended.

This file has a full implementation of the core Parse Functionalities (login, save file, CRUD parse objects and Relations, call cloud code function, and much more!)

Plus, It shows how Parse Live Queries are implemented in .NET by myself as well, using RX.NET so when it will be available in official parse for .NET, we will all enjoy it.

I'll be using that repo as the Sample Repo when redoing the documentation anyway. Hopefully before New Year but time will tell.

Best.

YBTopaz8

YBTopaz8 commented on Jan 9, 2025

@YBTopaz8
Member

Quickly Pinging to say please expect some updates this week (Got caught up here and there)

I aim to bring some more improvements I've been working on personally

Sorry for the delay!

YBTopaz8

YBTopaz8 commented on Feb 2, 2025

@YBTopaz8
Member

Working on closing this issue (See #407 ) and any other today.
Hopefully all moves well.

YBTopaz8

YBTopaz8 commented on Feb 2, 2025

@YBTopaz8
Member

Hi @patkozlowski
Now that #407 is closed, All your mentioned issued should be resolved.

Some insights to anyone curious;
Parse for .NET is heavily reliant on Encoding and Decoding and the right type of encoded/decoded data matters a lot.

As we know, some Parse datatypes are primitive (string, int, bool) and others are complex like Relations that use Dictionaries.
Little known fact is that Parse Operations (Set,add,addunique,delete etc..) are all fundamentally dictionary data you're sending to the Parse Server that will in its turn decode.

So in the previous release, as I attempted to make it so that only one method can handle both primitives and complex data types, I
simply had to change the return type of ConvertToJSON() from a specific Dictionary<string,object> to a generic object, that way,
this method
GenerateJSONObjectForSaving() found in ObjectServiceExtensions.cs file will now always have the right "value" encoded when I do

Here by Fixing ALL issues linked to Parse Objects not saving properly (thus, breaking relations in that process)

if (pair.Value != null)
{
    var objectToEncode = pair.Value;
    result[pair.Key] = PointerOrLocalIdEncoder.Instance.Encode(objectToEncode, serviceHub);
}

I'm looking forward to polish more stuff in the coming days - but do let me know if there's anything missing or suggestions 🙂

mtrezza

mtrezza commented on Feb 2, 2025

@mtrezza
Member

Great, can this issue be closed?

YBTopaz8

YBTopaz8 commented on Feb 2, 2025

@YBTopaz8
Member

Yes, @mtrezza please do.

mtrezza

mtrezza commented on Feb 2, 2025

@mtrezza
Member

Closing via #407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @mtrezza@patkozlowski@YBTopaz8

      Issue actions

        Missing methods in Parse .NET SDK 4.0 · Issue #397 · parse-community/Parse-SDK-dotNET