Just Simply Code

Another developer blog

  • Home
  • About
  • Register
  • Policy

Year: 2016

ASP.NET script bundling without minification

17 December 2016 / 1 Comment

In a project I recently joined, the team uses React for the front-end. They have a Gulp task which compiles jsx files to js files and minify them. The Gulp task also appends a version number at the end of the minified js file’s name. I notice that the front-end developer has to manually increment this version … [Read more…]

Posted in: Uncategorised Tagged: Bundling, Scripts Bundling

Mocking HTTP current context identity

3 December 2016 / 1 Comment

There are many places in the code in the project I’m working on where HttpContext.Current.User is used to get id of the currently logged in user. This can be tricky when it comes to unit testing functions using the HttpContext. One of the way to get around this is to mock the HttpContext by manually creating the identity. … [Read more…]

Posted in: Uncategorised Tagged: Mock data, Unit Testing

Dependency injection for Azure Webjob with Unity

23 November 2016 / Leave a Comment

In my previous post, I showed how to connect to FTP server via Azure Webjob. In this post, I’m going to show how to inject dependency in Azure Webjob using Unity. Azure Webjob uses a JobActivator to create instances of job classes. A custom job activator can be used to resolve any dependencies when creating instances. To … [Read more…]

Posted in: Uncategorised Tagged: Dependency Injection, Unity, Webjob

Azure webjob to check for files on an FTP server

6 November 2016 / Leave a Comment

In my last project, the client wants their files, once uploaded to the FTP server, processed and imported into their database. Previously, I would implement a windows service and install it on the FTP server. However, since the FTP server is hosted on Azure as a virtual machine so I decided to implement an Azure … [Read more…]

Posted in: Uncategorised Tagged: FTP, Webjob

Web API endpoint for file upload

23 October 2016 / Leave a Comment

I had built a web API endpoint for file upload before in the past using a custom media type formatter. Last week I had to build a web API endpoint for another project. This time, I decided to implement this a little differently by reading the file in the content from request. The old way In … [Read more…]

Posted in: Uncategorised Tagged: File Upload, WebAPI

Active menu item in MVC 5 using T4MVC

9 October 2016 / Leave a Comment

In my last post, I talked about a nuget package called T4MVC. In this post, I’m going to show how to show active menu item in MVC 5 with the help of T4MVC. The problem When starting the default MVC web application from Visual Studio, the main navigation menu does not show the active menu item … [Read more…]

Posted in: Uncategorised Tagged: MVC, T4MVC

Eliminating magic strings in MVC with T4MVC

23 September 2016 / Leave a Comment

I recently discover a nuget package called T4MVC and it has become a must-have on my tool belt. T4MVC helps eliminating magic strings in MVC and support strongly typed ActionResults.  See their project site here. In MVC, you have to use magic strings when specifying an action link. E.g. @Html.ActionLink(“View detail”, “Detail”, “Article”, new { id … [Read more…]

Posted in: Uncategorised Tagged: Magic strings, MVC, T4MVC

View components in MVC 6

10 September 2016 / Leave a Comment

Microsoft has replaced child actions in previous MVC versions with View Components in MVC 6. Child actions are useful for when you want to build reusable widgets but they have their own limitations, one those I mentioned in my last post. View components are similar to child actions but are lighter weight. Create a view component … [Read more…]

Posted in: Uncategorised Tagged: Async, MVC 6, ViewComponent

Child action in MVC 5 does not support async

4 September 2016 / 3 Comments

I have a need for creating a child action in a controller in my side project. I’ve been using async everywhere else in the application so it’s obvious that I’m going to make this child action async. My child action is similar to the example below: [ChildActionOnly] public async Task<ActionResult> SampleChildAction() { // Call an asynchronous … [Read more…]

Posted in: Uncategorised Tagged: Async, Child Action, MVC

Favicon in debug mode with Chrome

24 July 2016 / 1 Comment

I build a page that displays a list of items with pagination. When users click on the pager, an ajax call is made to get the items for the next page and only the list is updated. I expect to see only one call to the database to get the next set of items when … [Read more…]

Posted in: Uncategorised Tagged: Chrome, Favicon
1 2 3 Next »

Search Posts

Recent Posts

  • Override IHttpRequestBodyDetectionFeature.CanHaveBodyOverride value in .NET Core Web API
  • Allow empty request body in PUT and POST HTTP requests in .NET Core Web API
  • Modify request body with middleware in .NET Core Web API
  • Running MS Orleans on AWS ECS
  • Respect leading and trailing spaces when querying SQL Server
Support my blog here!Support my blog!

Archives

  • July 2024
  • June 2024
  • July 2023
  • April 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • October 2017
  • September 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • July 2016
  • June 2016
  • March 2016
  • February 2016
  • January 2016

Copyright © 2025 Just Simply Code.

Me WordPress Theme by themehall.com