Learning how to develop GraphQL solutions with .NET

Screen Shot 2019-08-26 at 11.04.33 PM

If you are building a data-driven web or mobile application, then key concerns you need to address is how data will be surfaced to the client and how the client can update the state on the server. This is not a new problem, and one that we have been solving for decades.

GraphQL provides one way to address this problem and uses an approach that provides significant benefits over previous RPC-based approaches. GraphQL was originally created at Facebook several years ago. It has been widely adopted since by Github, Concur, Airbnb and more. We’re even now adopting it at DocuSign. If you are doing React development, GraphQL has become the de-facto way to query from React clients.

What is GraphQL?

At its heart, GraphQL is several things.

  • A schema that allows defining a structured view of data that will be surfaced to / queried / updated by a GraphQL client.
  • A query language for interacting with a GraphQL endpoint to retrieve, update, and subscribe to notifications.
  • Tooling and SDKs for building GraphQL clients and servers, or interacting with GraphQL endpoints such as the GraphiQL editor, clients like Apollo and Relay, servers like Apollo, GraphQL for .NET, and more.

A few things that have stood out for me that I have really liked about GraphQL.

  • It provides a standard way to query and update data including non-crud based actions. It supports “graphs” of data allowing queries to pull hierarchical data.
  • It puts power in UI teams hands to be able to hand craft queries with the data they need, without having to constantly send custom requests to the API team.
  • It has GraphiQL which is an awesome intellisense-driven tool for querying GraphQL endpoints that you can provide to developers for interacting with the endpoint.
  • It can work side by side with, and wrap existing “REST” APIs
  • It is not opinionated about where data resides, it is not bound to a database. Data  could live in MongoDB, SQL, in documents like S3/Azure Blob, or even in memory. It is really easy to make GraphQL work with any data store
  • It allows full control from the server-side as to what data is exposed.

There are also plenty of tradeoffs with GraphQL vs traditional APIs and it is not a silver bullet. Fortunately it is not mutually exclusive and can live side by side with “REST” APIs. Still you should go in with eyes open (as with any other technology or approach).

GraphQL with .NET

Yes you can develop GraphQL solutions with .NET! There are several open source projects that enable this, my favorite one being GraphQL for .NET. GraphQL for .NET lets you create GraphQL schemas and queries in C#, and then surface them via an ASP.NET core endpoint. It also provides a C# client which you can use to issue queries from an application such as as a Xamarin mobile client. All of the libraries are also available on NuGet. If you head to the GraphQL for .NET documentation you can find out more.

I’ve also created an ASP.NET Core example endpoint which can be ran on Windows, Mac or Linux which you can download from here. The readme contains lots of example queries you can run using the GraphiQL editor that is built in.

Check out my LinkedIn Learning Course

If you are interested in learning more about GraphQL for .NET, you can also check out my LinkedIn Learning Course: API Development in .NET with GraphQL. In the course I’ll take you through building the Orders GraphQL endpoint above from scratch in ASP.NET Core. I show you how to use GraphQL for .NET to define your schema, queries, and mutations, and subscriptions and expose them via ASP.NET Core. It’s heavily code based so you can follow along and build it with me. If you check out the course, let me know what you think.

GraphQL is growing

GraphQL is exploding in traction, with more and more companies adopting it as the standard. All signs are that will continue. It is exciting that this powerful ecosystem is available now to you as a .NET developer!

Posted in ASP.NET, ASP.NET Core, GraphQL | 4 Comments

A new serverless adventure at Auth0

Last week was my last of a great ride at Splunk. I have now joined Auth0 working on a new developer-focused offering around Serverless compute, with Webtask. I’ve also started a new blog to discuss more broader topics on tech, startups etc.

Read more on what I am doing now here!


Posted in serverless | 21 Comments

.NET Fringe is back!

And we’re back!

Yes it’s true, .NET Fringe is back! We’re gathering back in Portland from July 10th through 12th for 3 days of unadulterated .NET OSS awesomeness. Last year we had a magical event, and we heard you tell us that you couldn’t wait for next year. So this year we’re back and we’re taking it up a notch! You can hear more about why we’re doing .NET Fringe and our plans for this year in our recent Channel 9 Interview.






The Topics

We’ve got a rich and diverse set of topics this year that is very timely and relevant to what is happening in the industry. Just look at the list!

  • .NET Core
  • DevOps
  • Docker
  • Hadoop
  • IOT
  • Kubernetes
  • Linked Data
  • Microservices
  • Machine Learning
  • Mobile
  • Spark
  • Xamarin
  • IOT
  • OSS Project Management

The Speakers

And an excellent lineup of speakers starting with our keynotes. We are thrilled that the list includes Don Syme, the creator of F#!

Screen Shot 2016-06-16 at 8.24.28 PM







Lightning Talks

This year back by popular demand we’ll be having about 15 Lightning talks split across the two days. Got an idea you’d like to speak on, we’re open for submissions.


Once again we’ll have workshops free for attendees on July 10th. Aaron Stannard is back with more AKKA.NET goodness, and we have several other workshops. Stay tuned to dotnetfringe.org.

Everything else

There’s a ton of other cool stuff, like another awesome venue, the Geek Train from Seattle, a bike ride around Portland, live music, some great food oh and Portland!

Discounts for bloggers

Are you wanting to attend .NET Fringe but are short on cash?

Go write a blog post (and no, not just a one liner) either about your .NET Fringe experience last year, or why you want to attend this year. Then follow @dotnetfringe, tweet with your blog post and include @dotnetfringe or #dotnetfringe. We’ll follow you back and then DM you a 70% DISCOUNT CODE.

Don’t wait

.NET Fringe is around the corner. It’s going to be amazing. Go register and come join us!


Posted in .net | 9 Comments

Are you in the mood for HTTP?

Sometimes you are just in that mood (no, not that mood ;-)), you know that mood when you want to talk HTTP and APIs with a bunch of people that care. Recently Darrel Miller and I realized we’re in that mood, and so with a little nudging from Jonathan Channon, we decided now is a good time. And so, “In the Mood for HTTP” was born.

It is a new Q&A style show, where folks submit questions on all things HTTP and Darrel and I give answers. Every show is live via Google Hangouts on Air, AND it is recorded and immediately available. In terms of the content, one thing I think that is really nice is we’re getting to dive into some really deep areas of building APIs that are not well covered. For example what level of granularity of media types should you use? Do Microservices impact your API design? And much more!

We’re not always in agreement, we’re not always right. We do always have fun!

Read Darrel’s blog post which goes into more detail of that what and why, then come join us! You can find the previous episodes on our YouTube channel here.

Posted in Uncategorized | Leave a comment

Save your DNS and your SANITY when using VPN on a Mac (without rebooting)

There was time when using my Mac was bliss form a DNS perspective, I never had to worry about my routing tables getting corrupted. I could always rely on hosts getting resolved, life was good! And then a combination of things happened and well those good old days are gone :-(

  • The networking stack on OSX went downhill.
  • I joined Splunk.
  • I started using a VPN on my Mac (We use Juniper SSL VPN).
  • I started having to deal with this now recurring nightmare of my DNS suddenly failing, generally after using the VPN.

If you use a VPN on a Mac, I am sure you’ve seen it. Suddenly you type “https://github.com” in your browser, and you get a 404. “Is Github down?” you ask your co-workers? “Nope, works perfectly fine for me”. “Is hipchat down?”. “Nope, I am chatting away.”

Meanwhile. your browser looks something like this:

Screen Shot 2015-10-01 at 7.08.31 AM













So you reboot, and then you find out that Github was up all along, the problem was your routing tables got screwed somehow related to the VPN, either that or the DNS demons have taken over your machine!







After dealing with this constantly, you start to seriously lose your sanity! It will of course always happen at the most inopportune time, like when you are about to present to your execs or walk on stage!

But my friends, there is hope, I have a cure! This is a cure I learned from the wise ninjas at my office (Thank you Danielle and Itay!), it is a little bash alias, and it will save you AND your DNS. Drop it in your .bash_profile and open a new terminal.

alias fixvpn="sudo route -n flush && sudo networksetup -setv4off Wi-Fi && sudo networksetup -setdhcp Wi-Fi"

Next time the DNS demons come to get you, run this baby from the shell. It will excommunicate those demons and quick.

Screen Shot 2015-10-01 at 7.09.48 AM







Wait a few seconds, and bring up that webpage again.

Screen Shot 2015-10-01 at 7.09.57 AM







You DNS and Sanity are restored!

Posted in tips, Uncategorized | 11 Comments