நிறைய அனுபவங்கள், நிறைய படிப்பினைகள்
“Hired for .Net and asked me to learn and use this MVC – Keppel Shipyard given to me this wonderful opportunity. I have used MVC, LINQ with datacontext, SQL, WCF with service contract for web site, SQL Server Reporting service for reports, SQL Server Integration Service for data upload from flat file. – One man show”
MVC (Model – View – Controller)
User Interact with ‘CONTROLLER’ using view. ‘CONTROLLER’ communicates with ‘MODEL’ to process the request and return the result into the ‘VIEW’.
‘MODEL’ consists of the classes with data entity. ‘CONTROLLER’ consists of action, do communication between the ‘VIEW’ and ‘MODEL’ and do redirection to the view or route.
‘VIEW’ is the aspx form without code behind file, does display the model & view data and plain html controls. Plain HTML control and MVC controls are native to the MVC. Ajax, J-Query widgets and third party control like telerik helps to improve view functionalities.
MVC ASP.NET with entity framework development has two different approaches. One is model first approach and another one database first approach. When you select the MVC project template in visual studio, it will create project with login, account and home models, controllers and views. And also create shared pages such as master page, error page; also generate default CSS (style sheet) file.
Model first approach: Create the model for related objects (classes for tables with properties for its fields) then generate the database using this model.
Data first approach: Create the database schema with all related SQL object such as tables, views and stored procedures first, then generate the entity data model (database context) using visual studio. When select the entity data model from template (VS 2010) pane, it opens the wizard to generate the code. When you connect the database the corresponding db connection string will be stored in the web config file. But it is not mandatory. Wizard generates the entity model and its related coding files automatically to the selected database objects as edmx file and code behind file. Whenever make changes in the database we can able to update the changes in this file. [do not make any code changes manually in these files, manual changes will be overwrite next time if update the db changes.]
Create Area if necessary right click on the project and choose area, area uses to group the related units (objects) as partition. Each area created with related model, controller and view folder and web.config file. If you want to create any customized classes, right click on the particular ‘MODEL’ folder and then select ‘class’ from the template pane. In database first model, model code will be generated by IDE. So, we do not worry about this portion, we have to focus on the ‘CONTROLLER’. Right click on the controller folder choose add controller if you want to create the action result for Edit, Delete, Detail and Add actions, check the corresponding check boxes in the small dialog box when appear (like message box with name text box, check boxes and OK button). Controller file will create with related action blocks as skeleton. (That means file will be created in the corresponding location and related links will be created. But 100% code would not be generated automatically. It will create code file with namespace, class and with some basic function name.) Fill the action blocks with related queries and save the result into appropriate model object instance and pass this to view. When this action performs result will return to the corresponding view. Still we have not created the view, if we browse URL route with this action (MVC url consists of ‘route’ and ‘action’), it will be displayed the error ‘no such corresponding full view or partial view either in view location or shared location. Let start to create the view. Open the controller choose the action (need to create the view) right click on it then choose to create the view. Dialogue box will appear with following option
- Partial view
- Strongly typed view
- Choose the model – When you choose strongly typed view, you have to choose the corresponding model from this dropdown (Whatever model code generated in the db context will be appeared here. If the list of Model not appeared here, compile the solution first, all Models will appeared immediately)
- Choose the view (index, details, create, edit and delete)
- Choose engine
Upgrade the project from MVC 2 to MVC 3
- Change mvc reference
- Update corresponding version configuration In all the web configuration file from root to individual group.
- Update web configuration root file update which version (old) to which version (new)
நேரம் கிடைக்கும் போதெல்லாம் விரிவு படுத்த முனைகிறேன்.