ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.22k stars 744 forks source link

How can I approach to solve this "challenge"? #1429

Closed wdamaral closed 3 years ago

wdamaral commented 4 years ago

Hi,

I'm pretty new to GraphQL + .NET Core, which eventually makes me to have some questions about development. I have to develop a prototype using GraphQL + .Net Core 3. The company uses SQL Server 2016. One of the suggestions is to use JSON columns in some tables to make it easier to insert any data.

I just need a light to help me on the approach.

Imagine the following DB - Just an abstract example

CARS


carID int PRIMARY,

carType VARCHAR,

COMPONENTS


carID FOREIGN KEY,

componentID PRIMARY KEY,

componentType VARCHAR,

componentDetails JSON COLUMN

Cars can have multiple components;

Depending on the componentType, the JSON changes.

Let's say I have a componentType SEATBELT, which would have a json like this


{

"color" : "black",

  "material" : "nylon"

}

But I can also have a componentType BATTERY, which would have a json like this


{

  "brand" : "DieHard",

  "voltage" : 12.6

}

How can I approach to solve this problem using HotChocolate? Is there any example I can take a look which uses JSON column from SQL Server?

michaelstaib commented 4 years ago

Hi,

we have a very active slack channel where you might find some more help on more General questions.

To hc it does not matter where your data comes from.