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

How to detect if node does not exists #292

Open
L10Messi10 opened this issue Jul 16, 2022 · 0 comments
Open

How to detect if node does not exists #292

L10Messi10 opened this issue Jul 16, 2022 · 0 comments

Comments

@L10Messi10
Copy link

Hello, I'm working on a real-time database. And I want to know if is there a way to detect if the node has existed?

The code below displays the subject of a teacher within the school on the student app, but I have another app that would remove the "classkey" (on the teacher's app). The problem here is; When calling this function, it doesn't give an error or so for me to catch that error and notify the student that the class for these subjects has been removed. So I'm wondering, is there a way to check if the key for that node has existed or not?

`public ObservableCollection GetClassSubjects(string classkey)
{

        //This code must detect if the node is available or not
        var subjects = client
            .Child($"Schools/{schoolKey}/Teachers/{T_Key}/MyClass/{classkey}/Subjects")
            .AsObservable<Subjects>()
            .AsObservableCollection();
        return subjects;
    }`
@L10Messi10 L10Messi10 changed the title How to detect if node exists How to detect if node does not exists Jul 16, 2022
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

No branches or pull requests

1 participant