This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ProjectName.WebApi.Infrastructure | |
{ | |
using System; | |
using System.Net; | |
using System.Net.Http.Headers; | |
using System.Web.Http.Filters; | |
public class CacheAttribute : ActionFilterAttribute | |
{ | |
public CacheAttribute() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tempfolder = $env:TEMP | |
$chmfile = Get-ChildItem | Where-Object {$_.Extension -match "chm"} | |
"Copying to local temp folder: $tempfolder" | |
Copy-Item $chmfile $tempfolder | |
"Opening $chmfile" | |
Start-Process $tempfolder\$chmfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web; | |
using System.Web.Mvc; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Serialization; | |
public class JsonNetResult : JsonResult | |
{ | |
public override void ExecuteResult(ControllerContext context) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var response = new HttpResponseMessage | |
{ | |
StatusCode = (HttpStatusCode)429, | |
ReasonPhrase = "Too Many Requests", | |
Content = new StringContent(string.Format(CultureInfo.InvariantCulture, "Rate limit reached. Reset in {0} seconds.", data.ResetSeconds)) | |
}; | |
response.Headers.Add("Retry-After", data.ResetSeconds.ToString(CultureInfo.InvariantCulture)); | |
actionContext.Response = response; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
CLS | |
ECHO --- | |
ECHO This command needs scriptcs (see http://scriptcs.net/) | |
ECHO If it is not installed you will get an error | |
ECHO --- | |
scriptcs PrepResourceFilesForTranslator.csx | |
ECHO --- | |
PAUSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class AutoMapperConfiguration | |
{ | |
public static void Configure() | |
{ | |
Mapper.CreateMap<OriginalEntity, DtoEntity>() | |
.ForMember(dest => dest.EntityId, source => source.MapFrom(s => s.Id)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
var xmlFormatter = config.Formatters.XmlFormatter; | |
config.Formatters.Remove(xmlFormatter); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
// just camel case | |
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); | |
// or camel case plus nicer formatting | |
var json = config.Formatters.JsonFormatter; | |
json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################### | |
# BEGIN CONFIGURATION | |
##################### | |
Update-ExecutionPolicy Unrestricted | |
Set-WindowsExplorerOptions -DisableShowHiddenFilesFoldersDrives -DisableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar | |
Disable-InternetExplorerESC | |
Disable-UAC | |
# Disable defrag (no need when having an SSD) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<location path="favicon.ico"> | |
<system.webServer> | |
<staticContent> | |
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" /> | |
</staticContent> | |
</system.webServer> | |
</location> |
OlderNewer