Blog

Blog posts on .NET, Azure, and more.

dnx-watch - A no-compile developer experience

October 16, 2015 by Anuraj

aspnet5 dnx codeproject

If you’re using Visual Studio 2015 for ASP.NET 5 development, you can leaverage no-compile developer experience from Visual Studio, powered by Roslyn. This feature helps developers to see the code changes without compiling the source code. This feature was not available for DNX / K runtimes. There are some third party solutions available like kmon, which monitors the directory and restarts the server without user interaction. Long back I also wrote a C# wrapper on top of (K runtime)[https://dotnetthoughts.net/k-web-command-and-agile-development-environment/]. The implementation is pretty strainght forward, using a filewatcher, I will be monitoring the directory and if there is any change, I will restart server. Incase of project.json file, I will be executing the package restore command and restarts the server. In ASP.NET5 Beta 8, ASP.NET team created a wrapper on top of DNX command, it is called dnx-watch. The dnx-watch command will run your application and then watch all of the project files for changes. When a file is changed the dnx-watch command restarts the application. This enables a rapid development workflow where you edit the code, save, and then refresh your browser to see the changes. You can install dnx-watch using dnu.

Ajax file upload with ASP.NET5

October 15, 2015 by Anuraj

aspnet5 jquery codeproject

This post is about uploading files to ASP.NET 5 web application using HTML5 file API. Most of the HTML5 File upload examples are using the “HttpContext.Current.Request.Files” which is not implemented in the ASP.NET5. The alternative is to use IFormFile, it is working fine, if you are using the normal Form - File upload combination. But in case of Ajax file upload it is not working. Later I found a SO post, which talks about File upload in ASP.NET5. It is mentioned like you need to read the body contents and save it using file stream. But when I did that, it was also not working. Later I found that the body contains the filename and content type information as well like this.

Minimal ASP.NET MVC 6 Application

October 02, 2015 by Anuraj

aspnet5 mvc6

Today in ASP.NET forums someone asked a question like a minimal MVC 6 application, where the controller method returns a simple string. For an ASP.NET 5 project, you require minimum two files, project.json, references required for the project and startup.cs, entry point and services configuration. Since it is MVC6 application you require one controller as well.

Using Typescript in aspnet5

October 02, 2015 by Anuraj

aspnet5 Typescript

This post is about using Typescrit in ASP.NET 5. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source. Since ASP.NET can run on any platform, this post is not using Visual Studio, but using Visual Studio code, you can do this using command line as well.

Generic repository in aspnet5

October 01, 2015 by Anuraj

aspnet5 design pattern C# CodeProject

In this post, I am explaining generic repository pattern using EF7. The Repository Pattern is a common construct to avoid duplication of data access logic throughout our application. The purpose of the repository is to hide the details of accessing the data. We can easily query the repository for data objects, without having to know how to provide things like a connection string. The Repository pattern adds a layer between the data and domain layers of an application. It also makes the data access parts of an application better testable.

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub