Tuesday, 29 November 2016
Once the installation process is completed successfully, you will see the following dialog
Once all is done, you will see the main window of Visual Studio as shown in the following screenshot.
You are now ready to start your application.
Friday, 25 November 2016
Auto Increment Id in Sql Server
SQL server identity column values use in table
Steps-Firstly Open-> Sql Server Create Table -> First Field Like ID Usually Autoincrement=>
Table create then=>insert data in table=> then Select data show increment id.
Table create then=>insert data in table=> then Select data show increment id.
The following SQL statement defines the "ID" column to be an auto-increment primary key field in the "Category" table (Given Category is Table Name and CategoryId And CategoryName are Field in Table
Create table Category
We use IDENTITY(1,1) in Table .
Create table Category
(
CategoryId INT IDENTITY(1,1) Primary Key,
CategoryName NVARCHAR(100)
)
We use IDENTITY(1,1) in Table .
Where the 1,1 is the starting number is 1 and increment by 1 that's the resion We use Identity(1,1)
In the example above, the starting value for IDENTITY is 1, and it will increment by 1 for each new record.
Exp. To specify that the "ID" column should start at value 10 and increment by 5, change it to IDENTITY(10,5).
In This Following Image CategoryId Is Auto Increment And Id id Start with 1 and It Will
Increment By 1
1. Create Table With Create Query.
2. Insert Data With Insert Query.
3. Show Table Data Through Select Query in Sql Server.
Thursday, 24 November 2016
MVC Framework Architecture
MVC Flow-
MVC application takes place when certain request comes from the client. The diagram below shows the flow:
Flow Steps
- 1. The client browser sends request to the MVC Application.
- 2. Global.ascx receives this request and performs routing based on the URL of 3. incoming request using the RouteTable, RouteData, UrlRoutingModule and MvcRouteHandler objects.
- 3. This routing operation calls the appropriate controller and executes it using the IControllerFactory object and MvcHandler object's Execute method.
- 4. The Controller processes the data using Model and invokes the appropriate method using ControllerActionInvoker object
- 5. The processed Model is then passed to the View which in turn renders the final output.
Wednesday, 23 November 2016
The Evolution of MVC
Microsoft had introduced ASP.NET MVC in .Net 3.5,since then lots of new features have been added.The following table list brief history of ASP.NET MVC.
3. Visual Studio - VS 2013
4. .Net Version - .Net 4.5 framework
5. Features -
1. Attribute based routing
2. Minor update of Asp.Net MVC5
3. Asp.Net MVC 5 bug fixed
2. Release date - 17 October 2013
3. Visual Studio - VS 2013
4. .Net Version - .Net 4.5 Framework.
5. Features -
1. Authentication filters
2. One Asp.Net.
3. Asp.Net Identity.
4. Bootstrap support in MVC template.
5. New Asp.Net scaffolding.
6. Authentication filters.
7. Minor update of Asp.Net MVC5.
8.Asp.Net MVC 5 bug fixed.
2. Release date - 15 August 2012 .
3. Visual Studio - VS 2010 SP1 and VS 2012.
4. .Net Version - .Net 4.0/.Net 4.5 Framework.
5. Features -
1. Add Window Azure SDK support feature.
2. Bundling and Minification.
3. Introduce Asp.Net Web API.
4. Mobile Project Template using jquery mobile.
5. Display Modes.
2. Release date - 13 January 2010
3. Visual Studio - VS 2013
4. .Net Version - .Net 4.0 Framework
5. Features -
1. Razor view engine.
2. ViewBag dynamic property.
3. Entity framework Code First.
4. Global action filters.
5. Dependency resolver for IoC.
6. Remote validation.
7. Compare Attribute.
2. Release date - 10 March 2010
3. Visual Studio - VS 2008
4. .Net Version - .Net 3.5/.Net 4.0 Framework
5. Features -
1. Client side validation.
2. Scaffolding.
3. Asynchronous controller.
4. Area for creating module based application.
5. Lambda expression based Html helpers.
6. DataAnnotation attribute
7. Custom template Helper
2. Release date - 13 March 2009
3. Visual Studio - VS 2008
4. .Net Version - .Net 3.5 Framework
5. Features -
1. MVC architecture pattern and web form engine
2. Auto binding
3. Ajax Helpers
4. Html Helpers
5. Routing
6. Unit testing
ASP.Net MVC 5.2 [Current]
1. MVC Version - Asp.Net MVC 5.2
2. Release date - 28 August 20143. Visual Studio - VS 2013
4. .Net Version - .Net 4.5 framework
5. Features -
1. Attribute based routing
2. Minor update of Asp.Net MVC5
3. Asp.Net MVC 5 bug fixed
ASP.Net MVC 5
1. MVC Version - Asp.Net MVC 5.02. Release date - 17 October 2013
3. Visual Studio - VS 2013
4. .Net Version - .Net 4.5 Framework.
5. Features -
1. Authentication filters
2. One Asp.Net.
3. Asp.Net Identity.
4. Bootstrap support in MVC template.
5. New Asp.Net scaffolding.
6. Authentication filters.
7. Minor update of Asp.Net MVC5.
8.Asp.Net MVC 5 bug fixed.
ASP.Net MVC 4
1. MVC Version - Asp.Net MVC 4.02. Release date - 15 August 2012 .
3. Visual Studio - VS 2010 SP1 and VS 2012.
4. .Net Version - .Net 4.0/.Net 4.5 Framework.
5. Features -
1. Add Window Azure SDK support feature.
2. Bundling and Minification.
3. Introduce Asp.Net Web API.
4. Mobile Project Template using jquery mobile.
5. Display Modes.
ASP.Net MVC 3
1. MVC Version - Asp.Net MVC 3.02. Release date - 13 January 2010
3. Visual Studio - VS 2013
4. .Net Version - .Net 4.0 Framework
5. Features -
1. Razor view engine.
2. ViewBag dynamic property.
3. Entity framework Code First.
4. Global action filters.
5. Dependency resolver for IoC.
6. Remote validation.
7. Compare Attribute.
ASP.Net MVC 2
1. MVC Version - Asp.Net MVC 2.02. Release date - 10 March 2010
3. Visual Studio - VS 2008
4. .Net Version - .Net 3.5/.Net 4.0 Framework
5. Features -
1. Client side validation.
2. Scaffolding.
3. Asynchronous controller.
4. Area for creating module based application.
5. Lambda expression based Html helpers.
6. DataAnnotation attribute
7. Custom template Helper
ASP.Net MVC 1
1. MVC Version - Asp.Net MVC 1.02. Release date - 13 March 2009
3. Visual Studio - VS 2008
4. .Net Version - .Net 3.5 Framework
5. Features -
1. MVC architecture pattern and web form engine
2. Auto binding
3. Ajax Helpers
4. Html Helpers
5. Routing
6. Unit testing
Sunday, 20 November 2016
MVC vs ASP.NET
There are various positive points to Using MVC
1. TDD support out of the box as most of the design is based on interfaces.
2. SEO friendly URL by design (though now this is possible in ASP.NET 4 as well)
3. No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4. Clean View Markup (no additional HTML emitted)
5. 100% extensible. You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6. Rich UI support (possible through client side JS libraries like jQuery UI and others). Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7. Session, JS, Ajax works. Validation is even more powerful with DataAnnotations and jquery.
8. Is MVC faster? Yes by default because of lack of viewstate and clean markup. But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9. Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though asp.net does has this to some extent)
10. Out of the box minimal IOC support.
11. Full control over rendered HTML
12. Pluggable architecture
3. No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4. Clean View Markup (no additional HTML emitted)
5. 100% extensible. You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6. Rich UI support (possible through client side JS libraries like jQuery UI and others). Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7. Session, JS, Ajax works. Validation is even more powerful with DataAnnotations and jquery.
8. Is MVC faster? Yes by default because of lack of viewstate and clean markup. But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9. Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though asp.net does has this to some extent)
10. Out of the box minimal IOC support.
11. Full control over rendered HTML
12. Pluggable architecture
***ASP.NET WebForms developers migrating to ASP.NET MVC initially feel a little uncomfortable because they are unable to find many key features that were available in WebForms approach. There are many questions comes to their minds like below:
1. Web is still stateless but where is the Viewstate?
2. Where is that Code behind file?3. What is that Razor syntax? Why I need it?
4. Where to find Page_Load method? that is used to put code for almost every page.
4. What about Binding and Rich Server Controls? Where these controls gone?
Friday, 18 November 2016
Main Advantage Of MVC
There Are Many Advantage of MVC(Model view & Controller)
1. Faster development process.
2. Easier to manage complexity (divide and conquer).
3. It does not use server forms and view state.
4. Front Controller pattern (rich routing).
5. Better support for test-driven development.
6. Ideal for distributed and large teams .
7. High degree of control over the application behavior.
8. Enables the full control over the rendered HTML.
9. Provides clean separation of concerns(SoC).
10. Enables Test Driven Development (TDD).
11. Easy integration with JavaScript frameworks.
12. Following the design of stateless nature of the web.
13. RESTful urls that enables SEO.
14. No ViewState and PostBack events.
2. Easier to manage complexity (divide and conquer).
3. It does not use server forms and view state.
4. Front Controller pattern (rich routing).
5. Better support for test-driven development.
6. Ideal for distributed and large teams .
7. High degree of control over the application behavior.
8. Enables the full control over the rendered HTML.
9. Provides clean separation of concerns(SoC).
10. Enables Test Driven Development (TDD).
11. Easy integration with JavaScript frameworks.
12. Following the design of stateless nature of the web.
13. RESTful urls that enables SEO.
14. No ViewState and PostBack events.
Wednesday, 16 November 2016
MVC OverView
Introduction
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications. The ASP.NET MVC framework is a lightweight, highly estable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.
Model:
Model represents shape of the data and business logic.It maintains the data of The application. Model objects retrieve and store model state in a database.
Note - Model is a data and business logic.
View:
View is a user interface. View display data using model to the user and also enables them to modify the data.
Note - View is a User Interface.
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications. The ASP.NET MVC framework is a lightweight, highly estable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.
Model:
Model represents shape of the data and business logic.It maintains the data of The application. Model objects retrieve and store model state in a database.
Note - Model is a data and business logic.
View:
View is a user interface. View display data using model to the user and also enables them to modify the data.
Note - View is a User Interface.
Controller:
Controller handles the user request. Typically, user interact with View, which in-tern raises appropriate URL request, this request will be handled by a controller. The controller renders the appropriate view with the model data as a response.
Note - Controller is a request handler.
The following figure illustrates the flow of the user's request in ASP.NET MVC See Above-.
Request/Response in MVC Architecture
As per the above figure, when the user enters a URL in the browser, it goes to the server and calls appropriate controller. Then, the Controller uses the appropriate View and Model and creates the
the response and sends it back to the user.
Tuesday, 8 November 2016
Get Random Rows in SqlServer
How To Get Random ROWS in Table Using Sql Server
Step 1-
Open Sql Server and Create Table like in Ex.
Ex.
Step 2-
We want to fetch Unique Randomly Rows and values in table Then use query like
Syntax- SELECT TOP 2 * FROM tbl_Randomvalues ORDER BY NEWID()
Result
Step 1-
Open Sql Server and Create Table like in Ex.
Ex.
Step 2-
We want to fetch Unique Randomly Rows and values in table Then use query like
Syntax- SELECT TOP 2 * FROM tbl_Randomvalues ORDER BY NEWID()
Result
The key here is the NEWID function, which generates a globally unique identifier (GUID) in memory for each row.By definition, the GUID is unique and fairly random; so, when you sort by that GUID with the ORDER BY clause, you get a random ordering of the rows in the table.
So finaly we get Unique and Random rows by using this query. We use Top 2 its use to only Top 2 result in table.
SELECT TOP 2 * FROM tbl_Randomvalues ORDER BY NEWID()