Don't wanna be here? Send us removal request.
Text
Design Pattern in C# https://anshuvermalive.com/Tutorial/DesignPattern
0 notes
Text
MVC #2 - ASP.NET MVC folder structure
When our project created let's see what we got inside the project. So open up Solution Explorer here we got the bunch of folders as below :-
App_Data :-
It is where our database file is stored.
App_Start :-
It includes few classes like BundleConfig.cs, FilterConfig.cs, IdentityConfig.cs, RouteConfig.cs, Startup.Auth.cs that are called when the application is started.
RouteConfig.cs :-
This file consists the configuration about routing rules. Here we see the route with the name "Default" and has a URL pattern. So if a URL matches this pattern, the first part of the URL is assumed to be the name of the controller, the second part is assumed to be the name of the action and the third part is an id which can pass to the action. We can see we have some default values in this route. So, if a URL doesn't have any of this parts it will be passed to the "Home" controller. Similarly if the URL has only the controller but not the action it will be handled by the "Index" action. Also we can see that id is an optional parameter because not the every action needs an id we all need this when we are working with the specific resource like a movie or a customer with the given id.
Content :-
Here we store the CSS files, images and any other client side assets.
Controller :-
Our default project template has three controllers. "Account" which has actions for Sign up, login, log out. "Home" which present the home page and manage to provide for handling requests around users profile like changing password, enabling two factor authentication, using social logins and so on.
Fonts :-
We have fonts which should not be here in the root. I will personally prefer to move this under content folder.
Models :-
We have Models so all are domain classes will be here.
Scripts :-
Where we store our JavaScript file.
Views :-
In Views folder, we have folders named same as controllers in our applications. So by convention, when we use a view in a controller ASP.NET MVC will look for that view in the folder with the same name as the controller.
Shared :-
This includes views that can be used across different controllers.
favicon.ico :-
favicon is the icon of the application displayed in the browser.
Global.asax :-
This is one that has been in ASP.NET for a long time and it is a class that provides hooks for various events in the application life cycle. So let's expand this open the C# file (Gloabal.asax.cs) so when the application is started, the method Application_Start() is called. And here we can see we are registering a few things like the Routes. So when the application started we tell the runtime these are routes for application.
Packages.config :-
This is used by the NuGet package manager. If we have never heard for NuGet. It is a package manager similar to NPM (Node package manager) or Bower. If you never heard for any package manager before, we use them to manage the dependencies of our applications. So let's say our application has dependency to five external libraries. Instead of going to five different websites for downloading this libraries, it is more easy to use package manager because the package manager and this NuGet package manager will download these dependencies from its central repository. Also if in the future one of these libraries has a newer version. Again we use our package manager to upgrade one or more of the existing packages. We don't have to go to the five different websites.
Startup.cs :-
This is a new approach Microsoft is taking for starting the application. So the next version of ASP.NET called ASP.NET CORE 1.0, they have dropped the global.asax and all the startup logic is implemented in this Startup class.
Web.config :-
This is a XML that includes the configuration for the application. Out of all the elements we see in this XML, mostly we only to work with only two sections. "connectionStrings" which is where we specify the database connection string and "appSettings" which is where we define configuration settings for application.
0 notes
Text
What is React?
React is an open-source JavaScript library used for creating dynamic and interactive user interfaces for mobile and web applications. It is highly flexible, declarative and efficient for developing scalable, simple and fast front-end for web and mobile applications.
In simple we can say ReactJS effectively handles the view layer of mobile and web application. React is flexible in such a way that in any application we can use as little or as much react as we need, for example react can be used in any existing web application to develop a new feature or the application and their UI can be developed using React.
Remember react is only concerned with rendering data to the document object model and so creating react based applications usually requires the use of additional libraries for implementing things like state management and routing.
0 notes
Text
1. What is ASP.NET MVC?
MVC is one of the architectural pattern for implementing user interfaces.
MVC components :-Model : Application data and behaviour in terms of its domain and independent of the UI.
View : The HTML markup that we display to the user.
Controller : Responsible for handling HTTP request. Get data from database through the model, put them in the view and return the view to the client or the browser.
There is one more piece to this architecture which is not in the acronym "MVC" but it is nearly always there. It's router. When a request comes in an application, a controller will be selected for handling that request. Selecting the right controller is the responsibility of the router.
A router based on some rules knows that the request with a URL should be handled by a class. More accurately it should be handled by one of the methods in the class because a class can have many different methods.
In ASP.NET MVC we refer to method of a controller as actions. So it is more accurate to say with, an action in a controller is responsible for handling a request.
Benefit of MVC :- Better separation of concern : With this architecture each component has distinct responsibility and this results in better separation of concerns and more maintainable application.
1 note
·
View note