Skip to content

Missing methods in Parse .NET SDK 4.0 #397

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

Closed
patkozlowski opened this issue Dec 19, 2024 · 14 comments · Fixed by #407
Closed

Missing methods in Parse .NET SDK 4.0 #397

patkozlowski opened this issue Dec 19, 2024 · 14 comments · Fixed by #407
Labels

Comments

@patkozlowski
Copy link

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!

Copy link

Thanks for opening this issue!

@YBTopaz8
Copy link
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
Copy link
Member

mtrezza commented Dec 20, 2024

@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.

@mtrezza mtrezza changed the title Issue when upgrading to Parse SDK 4.0 Missing methods in Parse .NET SDK 4.0 Dec 20, 2024
@YBTopaz8
Copy link
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
Copy link
Member

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

@YBTopaz8
Copy link
Member

YBTopaz8 commented Dec 21, 2024

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

YBTopaz8 added a commit that referenced this issue Dec 21, 2024
Did some general enhancements on the code structure it's more consistent (Working on `object` types are cool but a pain to debug since you never know the real type until you hit an exception.)

I tried to make it so the code is more readable as well.

Closes
#397
@patkozlowski
Copy link
Author

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

@YBTopaz8
Copy link
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
Copy link
Member

YBTopaz8 commented Jan 9, 2025

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
Copy link
Member

YBTopaz8 commented Feb 2, 2025

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

@YBTopaz8
Copy link
Member

YBTopaz8 commented Feb 2, 2025

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
Copy link
Member

mtrezza commented Feb 2, 2025

Great, can this issue be closed?

@YBTopaz8
Copy link
Member

YBTopaz8 commented Feb 2, 2025

Yes, @mtrezza please do.

@mtrezza
Copy link
Member

mtrezza commented Feb 2, 2025

Closing via #407

@mtrezza mtrezza closed this as completed Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment