WebAPI file upload

[HttpPost]
 [HttpPost]
[Route("shpupload")]
public async Task UploadShp()
{
    if (!Request.Content.IsMimeMultipartContent())
    {
        return new NegotiatedContentResult<string$(HttpStatusCode.UnsupportedMediaType,
            "Content is not supported", this);
    }

    var subFolder = Guid.NewGuid().ToString();
    var fullPath = Path.Combine(@"f:\temp", subFolder);

    if (!Directory.Exists(fullPath))
    {
        Directory.CreateDirectory(fullPath);
    }

    try
    {
        var streamProvider = new MultipartFormDataStreamProvider(fullPath);
        await Request.Content.ReadAsMultipartAsync(streamProvider)
            .ContinueWith(o =>
            {

                if (o.IsCanceled || o.IsFaulted)
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);

                foreach (var fileData in streamProvider.FileData)
                {
                    File.Move(fileData.LocalFileName, Path.Combine(fullPath, fileData.Headers.ContentDisposition.FileName.Replace("\"", "")) );
                }

            });

        //first process the files
        //for (var f = 0; f < HttpContext.Current.Request.Files.Count; f++ )
        //{
        //    var file = HttpContext.Current.Request.Files[f];
        //    file.SaveAs(Path.Combine(fullPath, file.FileName));
        //}

        //and finally take care of the extra form data if any
        //HttpContext.Current.Request.Form[""];
        //...


    }
    catch (Exception ex)
    {
        return InternalServerError();
    }

    return Ok();
}

EF MigrationConfiguration per db context

Creating a custom migrations cfg for a particular context:

enable-migrations -ContextTypeName HereGoes.Custom.Context.TypeName -ConnectionStringName IfNeeded -MigrationsDirectory LetsCustomiseMigrationsStorage


Adding a custom migration for a specific configuration:

add-migration -ConfigurationTypeName HereGoes.Custom.MigrationsConfiguration.TypeName


Updating a database using custom migration configuration:

 update-database -ConfigurationTypeName HereGoes.Custom.MigrationsConfiguration.TypeName -ConnectionStringName IfNeeded 

ReSharper cannot resolve symbol

Sometimes R# tends to go nuts and stops 'understanding' the code properly: 


In such case wiping out its cache and rebooting VS seems to do the trick.
R# 10 cache folder is: %localappdata%\JetBrains\Transient\ReSharperPlatformVs14