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

Dotnet Core implementation? #3

Open
srini85 opened this issue Jan 14, 2018 · 3 comments
Open

Dotnet Core implementation? #3

srini85 opened this issue Jan 14, 2018 · 3 comments

Comments

@srini85
Copy link

srini85 commented Jan 14, 2018

@brendandburns burns
Would love to see a dotnet core implementation or even get some thoughts around how you see the interfaces of shaping up for it.

@brendandburns
Copy link
Contributor

I'd love to see this happen, but I think it's tricky. In the javascript case we intercept a bunch of read/writes automagically and persist the data to a central store. I'm not sure what the right way to do this is in C#.

The simplest thing would be to provide a Dictionary and just persist that, but I feel like it doesn't quite mesh with the goals of the storage library which is to make such things "automatic" but if that's the best we can do, I suppose a Dictionary isn't a terrible starting place...

@srini85
Copy link
Author

srini85 commented Jan 27, 2018

@brendandburns could we use an expando object? this can give us a similar usability to js implementation?

using System;
using System.Dynamic;

namespace storage
{
    class Program
    {
        static void Main(string[] args)
        {
            dynamic dynamicVars = new ExpandoObject();

            try
            {
                Console.WriteLine($"before update of someVar: {dynamicVars.someVar}");
            } 
            catch
            {
                Console.WriteLine("Looks like the someVar doesnt exist.");
            }

            dynamicVars.someVar = "Hello World";

            Console.WriteLine($"after update of someVar: {dynamicVars.someVar}");
        }
    }
}

@srini85
Copy link
Author

srini85 commented Jan 29, 2018

@brendandburns - thought i will give the dotnet version a stab. WIP
https://github.com/srini85/storage/tree/initial-dotnet-version

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

2 participants