Reduce the json size in MVC 6

In here we removed all default value and null in our json output.

services.AddMvc()
        .Configure<MvcOptions>(options => {
          var jsonOutputFormatter = new JsonOutputFormatter();
          jsonOutputFormatter.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore;
          jsonOutputFormatter.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;

          options.OutputFormatters.RemoveTypesOf<JsonOutputFormatter>();
          options.OutputFormatters.Insert(0, jsonOutputFormatter);
          });
Advertisements

EntityFramework 7

After I upgrade my Win 10 to latest technical preview 10074 and upgrade my VS 2015 to RC. I got a lot of error into my project when I build it. I watch the Build 2015 to figure out what it has changes. Usually I using “k ef add migration addProfile” it not going work anymore. check out this docs the latest asp.net 5. http://docs.asp.net/en/latest/ DNX (Dot Net Execution Environment) dnx . ef migration add ¬†addProfile

Git swap branch to master

Sometimes in the development we always commit into the master but at the end we want to make our branch source become master.
I feel this is easier way to do it.

git branch -m master abandonmaster //Move the master to Branch abandonmaster
git branch -m branchName master //Move the branchName to master
git push origin master //push master to remote
git push origin abandonmaster //pust abandonmaster branch to remote