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

Attribute to specify the Key (ID) #320

Open
sact1909 opened this issue May 9, 2024 · 1 comment
Open

Attribute to specify the Key (ID) #320

sact1909 opened this issue May 9, 2024 · 1 comment

Comments

@sact1909
Copy link

sact1909 commented May 9, 2024

Create an attribute that allows the user to specify the Key property to use as ID when post a new object in case someone wants to use his datatype key structure as Guid, AutoEnum etc...

Example
Model Class

public class TodoItem
{
    [FirebaseKey]
    public Guid ID {get;set;}
    public string Title { get; set; }
}

await firebaseClient.Child("Todo").PostAsync(new TodoItem
{
    ID = Guid.NewGuid(),
    Title = "This is a Text"
});

Result in Firebase RealTiem Database

"Todo":{
    "621e7bf1-1d39-493f-a6b1-537afb5efa41":{
      "Title":"This is a Text"
    }
}
@sact1909
Copy link
Author

sact1909 commented May 9, 2024

I guess I could work on this if you allow me to do it

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