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

Add Bson integration #1127

Closed
GitAntoinee opened this issue Dec 23, 2019 · 3 comments
Closed

Add Bson integration #1127

GitAntoinee opened this issue Dec 23, 2019 · 3 comments
Labels
area-System.Text.Json enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@GitAntoinee
Copy link

Add Bson integration to a namespace like System.Text.Bson or System.Text.Json.Bson

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Text.Json untriaged New issue has not been triaged by the area owner labels Dec 23, 2019
@ahsonkhan ahsonkhan added this to the Future milestone Dec 24, 2019
@ahsonkhan ahsonkhan added enhancement Product code improvement that does NOT require public API changes/additions and removed untriaged New issue has not been triaged by the area owner labels Dec 24, 2019
@ahsonkhan
Copy link
Member

ahsonkhan commented Dec 24, 2019

Can you provide more details around your scenario, use case, and what types of APIs/capabilities you expect?

If you could share some requirements, and API shape along with sample code you would write on top, that would help motivate the feature.

@GitAntoinee
Copy link
Author

GitAntoinee commented Dec 24, 2019

I am currently using Newtonsoft.Json to serialize / deserialize bson,
I'd like to use it when I want to serialize to a stream or a return value using an object or an instance and deserialize byte array to return an object or an instance

void Save<TData>(string file, TData data)
{
    using var stream = File.OpenWrite(data);
    BsonSerializer.Serialize<TData>(stream, data); // Can be async
}
void Save<TData>(string file, TData data)
{
    var data = BsonSerializer.Serialize<TData>(data);
    File.WriteAllBytes(file, data);
}

or deserialization like :

TData Read<TData>(string file)
{
    using var stream = File.OpenRead(data);
    return BsonSerializer.Deserialize<TData>(stream); // Can be async
}
TData Read<TData>(string file)
{
    var data = File.ReadAllBytes(file);
    return BsonSerializer.Deserialize<TData>(data);
}

@layomia
Copy link
Contributor

layomia commented Feb 28, 2020

Closing - we don't have plans to support this format at the moment.

@layomia layomia closed this as completed Feb 28, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests

4 participants