facebook-csharp-sdk/facebook-csharp-sdk — pull request #311 by prabirshrestha (2014-08-16 23:23:38+00:00)
Title: Graph API versioning support

:warning: do not merge :warning: need to write unit tests. This doesn't include versioning for GetLoginUrl.

PR for #294

Since this is not a breaking change, anyone using v6.x should be able to update safely to this version.

By default it will not use any versioning. You need to set the `DefaultVersion` or `Version` to use versioning.

Usage:

**Set the default version for all instances of new `FacebookClient`.**

This will make a request using v2.1

```c#
FacebookClient.DefaultVersion = "v2.1";
var fb = new FacebookClient();
dynamic result = fb.Get("me");
Console.WriteLine(result);
```

**Override default version**

This will make a request using v2.0

```c#
FacebookClient.DefaultVersion = "v2.1";
var fb = new FacebookClient();
fb.Version = "v2.0";
dynamic result = fb.Get("me");
Console.WriteLine(result);
```

**Disable default versioning for a particular instance**

This will make a request without any version.

```c#
FacebookClient.DefaultVersion = "v2.1";
var fb = new FacebookClient();
fb.Version = null;
dynamic result = fb.Get("me");
Console.WriteLine(result);
```

**GOTCHAS**

**If full absolute url is given, `DefaultVersion` and `Version` property will be ignored**

The below code will use version 2.3.

```c#
FacebookClient.DefaultVersion = "v2.1";
var fb = new FacebookClient();
fb.Version = "v2.0";
dynamic result = fb.Get("https://graph.facebook.com/v2.3/me");
Console.WriteLine(result);
```

**Do not add version to path if `Version` property is set**

This will be an invalid request as the url will be http://graph.facebook.com/v2.0/v2.0/me

```c#
var fb = new FacebookClient();
fb.Version = "v2.0";
dynamic result = fb.Get("v2.0/me");
Console.WriteLine(result);
```

For more information on versioning refer to https://developers.facebook.com/docs/apps/versions