Skip to main content

Posts

Showing posts from January, 2020

ASP.NET MVC Routing

ASP.NET MVC Routing ASP.NET MVC routing is a pattern matching system that is responsible for mapping incoming browser requests to specified MVC controller actions. When the ASP.NET MVC application launches then the application registers one or more patterns with the framework's route table to tell the routing engine what to do with any requests that matches those patterns. When the routing engine receives a request at runtime, it matches that request's URL against the URL patterns registered with it and gives the response according to a pattern match. Routing pattern is as follows A URL is requested from a browser, the URL is parsed (that is, break into controller and action), the parsed URL is compared to registered route pattern in the framework’s route table, if a route is found, its process and send response to the browser with the required response, otherwise, the HTTP 404 error is send to the browser. Route Properties ASP.NET MVC routes are res...

Become a better developer by reading source code

BECOME A BETTER DEVELOPER BY READING SOURCE CODE By  Steve Gordon Hey friends! In this post, I’ll share some thoughts I have concerning the conscious reading and study of source code. In my opinion, reading code is a process which can help you become a more proficient software developer. It has undoubtedly improved and influenced my software development skills. SHOULD I READ SOURCE CODE? Yes, you should! The good news is, you’re already doing this, day in day out when developing software. I’ve seen various statistics over the years showing that a high percentage of our time as developers is spent reading code, rather than writing it. When you start on a new feature or on a bug fix, you have to begin by understanding how existing code works. You may tackle this from the unit tests which should clearly describe the desired behavior of existing code, but often you will end up delving into the implementation code as well. For this post, I consider this form of reading...

Models in ASP.NET MVC

Models in ASP.NET MVC Explained A model is a class that contains the business logic of your application. It also used for accessing data from the database. The model class does not handle directly input from the browser. In MVC, it is the Controller that handle input from the browser directly and process the request by receiving data from the model and pass it back to view as response. It does not contain any HTML code either. It is a best practice but not mandatory for developers to not have any communications with the view directly, models should only contain a POCO ( Plain Old CLR Objects ) classes. All processing logic and communication with the view should be handled by another layer called Viewmodels. Models are also refers as objects that are used to implement conceptual logic for the application. A controller interacts with the model, access the data, perform the logic and pass that data to the view. Note that it is not mandatory, but it is a good programming...