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

Is the result supposed to be a KeyValuePair? #325

Closed
herbertmilhomme opened this issue Apr 28, 2018 · 1 comment
Closed

Is the result supposed to be a KeyValuePair? #325

herbertmilhomme opened this issue Apr 28, 2018 · 1 comment

Comments

@herbertmilhomme
Copy link

I don't understand. I thought the end results were supposed to register the database values into the class so i can make calls like an enum function.

I'm looking for results like the first one, StronglyTyped by Jeremy. I got a response back from him on git and he told me that i should look into massive as an alternative to what he started as a prototype. But it doesn't feel the same, and the results don't look anywhere near what i was expecting them to be. I just need a bit of clarification on if Massive can perform the same job if not better than what StronglyTyped was supposed to do/be.

    //var data = Massive.DB.Current.Query(sql);
    //var data = Massive.DynamicModel.Open("DBServer1").Query(sql); 
    var data = new Massive.DynamicModel("DBServer1").Query(sql);
    Response.ContentType = "application/json";
    Json.Write(data, Response.Output);

each gave me the same:

[[{"Key":"Id","Value":1},{"Key":"StatusTitle","Value":"Inprogress"},{"Key":"StatusId","Value":7},{"Key":"Media","Value":"Website"}...

Normally, what i'd get without any extension service:

[{"Id":1,"StatusTitle":"Inprogress","StatusId":7,"Media":"Website"...

However, i'm hoping for there's a solution here.

@FransBouma
Copy link
Owner

FransBouma commented Apr 28, 2018

Massive uses Expando's (which are dictionaries) as types for its objects, and therefore there are no strongly typed properties so serialization to json will result in what you got and never in what you expected in your post: you can only get that if you serialize a strongly typed POCO to json, which isn't going to work with Massive as it doesn't use strongly typed poco's but expandos (dynamic types)

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