SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Downloaden Sie, um offline zu lesen
FOR MVC DEVLEOPERS THE FEAUTURES OF ASP.NET CORE
ASP.NET Core 1.0 gives a patched up Web development system adapted towards the prerequisites of
present day Web applications. The new structure, as of now in RC1, obliges you to learn numerous new
ideas not found in ASP.NET MVC 5. To that end, this article identifies a couple of essential
components that ASP.NET MVC 5 designers ought to know as they get ready to take in this new
structure.
1. ASP.NET Core on Numerous Runways
ASP.NET Core is a piece of .NET Core—another measured structure that backings numerous
stages.ASP.NET and the .NET framework are focused on towards the Windows stage. Then
again, ASP.NET Core is created to bolster various stages including Windows, Mac, and Linux.
This additionally implies, dissimilar to ASP.NET web applications, basically, keep running
under IIS, the ASP.NET Core applications can keep running under non-IIS Web servers.
Figure 1 demonstrates the part of the .NET Core and ASP.NET Core.
The part of the .NET Core and ASP.NET Core -
A Web application worked with ASP.NET Core can target ASP.NET Framework 4.6 or the
ASP.NET Core. The Web applications focusing on ASP.NET Framework 4.6 run just on the
Windows stage. The Web applications focusing on the ASP.NET Core can keep running on
Windows and non-Windows stages. Obviously, as on this composition, ASP.NET Core doesn't
offer the same rich usefulness offered by ASP.NET Framework 4.6.
2. Part of Project.json
ASP.NET Core utilizes an exceptional document—Project.json for putting away all the
undertaking level configuration data. Project.config can store numerous design settings, for
example, references to NuGet bundles utilized as a part of the task and target structures.
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Abstractions":
"1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json":
"1.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"EntityFramework.Commands": "7.0.0-rc1-final",
"Microsoft.AspNet.Session": "1.0.0-rc1-final",
"Newtonsoft.Json": "8.0.3"
The Project.json record stores configuration data in JSON position. The above markup
demonstrates a conditions segment that contains a rundown of NuGet bundles required by the
application. For instance, the Web application under thought requires the 6.0.0-rc1-last form of
Microsoft.AspNet.Mvc get together, etc
3. Part of AppSettings.json
ASP.NET stores application configuration settings in Web.config. For instance, engineers utilize
the <appSettings> area to store custom application settings, the <connectionStrings> segment to
store database association strings, etc. ASP.NET Core utilizes AppSettings.json to store such
bits of data.
Consider the accompanying configuration:
{
"AppSettings": {
"Title": "My ASP.NET Core Application"
},
"Data": {
"DefaultConnection": {
"ConnectionString": "data source=.;
initial catalog=Northwind;integrated security=true"
}
}
}
The previous JSON markup comprises of two properties or keys, to be specific AppSettings and
Data. The AppSettings property holds a sub-key named Title. The Title sub-key has a string
estimation of "My ASP.NET Core Application". Also, the Data key has a DefaultConnection
sub-key. The DefaultConnection thusly has a ConnectionString sub-key.
4. Application set-up
In ASP.NET, Global.asax goes about as the passage point for your application. You can wire
different events handlers for occasions, for example, Application_Start and Session_Start, in the
Global.asax record. In ASP.NET Core, the application startup happens in an unexpected way—
it happens through a Startup class.
one such Startup class -
public class Startup
{
public Startup(IHostingEnvironment env,
IApplicationEnvironment app)
{
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.SetBasePath(app.ApplicationBasePath);
builder.AddJsonFile("appsettings.json");
IConfigurationRoot config = builder.Build();
string str = config.Get<string>
("Data:DefaultConnection:ConnectionString");
// do something with str
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddEntityFramework()
.AddSqlServer();
}
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/
{action=Index}/{id?}");
});
}
public static void Main(string[] args) =>
WebApplication.Run<Startup>(args);
}
The Startup class appeared above starts with a constructor. The constructor stacks the
AppSettings.json record utilizing ConfigurationBuilder class. The Get() strategy then is utilized
to peruse the database association string put away in the AppSettings.json document.
The ConfigureServices() technique includes the administrations required by the application. For
instance, here you add MVC and Entity Framework to the administrations gathering.
The Configure() technique determines and arranges the administrations included before for
application's utilization. For instance, the MVC directing is designed in the code appeared
previously.
5. Tag Helpers
In ASP.NET MVC 5, you utilized HTML assistants, for example, BeginForm(), LabelFor(), and
TextBoxFor() to render structures and frame fields. You can keep on using HTML partners in
ASP.NET Core, too. However, there is a superior option: Tag Helpers. Label aides take the type
of standard HTML labels with certain extraordinary asp-* credits added to them.
Consider the accompanying markup that renders a structure:
<form asp-controller="Home" asp-action="Save" method="post">
<table border="1" cellpadding="10">
<tr>
<td><label asp-for="FirstName">First Name :</label></td>
<td><input type="text" asp-for="FirstName" /></td>
</tr>
<tr>
<td><label asp-for="LastName">Last Name :</label></td>
<td><input type="text" asp-for="LastName" /></td>
</tr>
<tr>
<td><label asp-for="Email">Email :</label></td>
<td><input type="text" asp-for="Email" /></td>
</tr>
<tr>
<td><label asp-for="Phone">Phone :</label></td>
<td><input type="text" asp-for="Phone" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit" />
</td>
</tr>
</table>
</form>
Observe clearly, the properties that start with asp-. They are characterized by the label aides.
For instance, the structure label aide utilizes asp-controller ascribe to indicate the objective
controller name and asp-activity credit to determine the objective activity technique name.
Correspondingly, asp-for traits utilized with name and info label partners tie a name or a text
box to a model property. Label partners are more advantageous to use than HTML assistants in
light of the fact that their linguistic structure nearly takes after the HTML markup.
6. View Components
In MVC 5, you utilized halfway perspectives as a way to reuse markup and code. ASP.NET
Core presents View Components, the more intense and adaptable option. A perspective part
comprises of a class normally acquired from ViewComponent base class and a perspective
record containing the required markup. This programming model is entirely like the one utilized
by controllers and perspectives. It permits you to separate code and markup from each other—
code in the perspective segment class and markup in a perspective. Once made, you can utilize
a perspective segment on a perspective by utilizing the @Component.Invoke() technique.
7. Dependency Injection
ASP.NET Core gives an inbuilt reliance infusion system. The DI system of ASP.NET Core
offers four-lifetime modes for a sort being infused:
Singleton: An object of an administration (the sort to be infused) is made and supplied to all the
requests to that administration. Along these lines, fundamentally all requests get the same article
to work with.
Scoped: An object of an administration is made for every single request. In this way, every
request gets another event of an administration to work with.
Transient: An object of an administration is made each time an article is asked.
Instance: For this situation, you are in charge of making an object of an administration. The DI
system then uses that case in singleton mode said prior
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddSingleton<IMyService,MyService>();
}
Here, MyService is the sort to be enlisted with the DI structure and actualizes IMyService. The
AddSingleton() technique enlists this type for Singleton mode portrayed previously. Once a sort
is enrolled with the DI system, you can infuse it in a controller like this:
public class HomeController : Controller
{
private IMyService obj;
public HomeController(IMyService obj)
{
this.obj = obj;
}
....
....
}
8. Gulp, Grunt, and Bower Support
Gulp and Grunt are JavaScript assignment runners. They help you computerize generally
required undertakings, for example, packaging JavaScript and CSS records, minifying
JavaScript and CSS documents, and arranging Less and Sass records (and some more). They are
introduced utilizing npm (Node Package Manager). The ASP.NET Core venture made utilizing
Visual Studio 2015 permits you to include Grunt and Gulp arrangement documents furthermore
gives Task Runner Explorer to screen the errands.
Bower is a bundle administrator basically for front-end bundles. Front-end bundles are the
bundles that you use in your Web pages, for example, JavaScript libraries/systems and CSS
records. For instance, you may introduce jQuery in your ASP.NET Core venture by utilizing
Bower. An ASP.NET Core venture made utilizing Visual Studio 2015 permits you to include a
Bower setup document. You likewise can work with the bundles utilizing the Manage Bower
Packages menu choice.
9. Single Programming for Web API Model for and MVC
In MVC 5, controllers acquire from the System.Web.Mvc.Controller base class. What's more,
Web API 2 controllers acquire from System.Web.Http.ApiController. In ASP.NET Core, both of
these structures are converged into a solitary system. Therefore, under ASP.NET Core, an MVC
controller and Web API controller both acquire from Microsoft.AspNet.Mvc.Controller base
class. You then can design viewpoints, for example, HTTP verb mapping and the directing of
the controllers as coveted.
10. Static Files and the wwwroot Folder
In ASP.NET, there is no settled area for putting away static documents, for example, picture
records, JavaScript documents, and CSS records (engineers regularly utilized a Content
envelope to store such documents). In ASP.NET Core, all the static records are kept under the
wwwroot envelope (default). You likewise can change the name of this envelope by utilizing the
Project.json document.
Refer the figure following down -
After arrangement, the wwwroot turns into the Web application's root. Every one of the URLs
to static records are determined as for this envelope. Along these lines,/pictures/logo.png
anticipates that logo.png will be available under the wwwroot/pictures envelope.
Conclusion -
ASP.NET Core 1.0 is a redone system outfitted towards present day cloud based, measured Web
applications. Despite the fact that the new structure safeguards the key ideas of MVC 5, ASP.NET
engineers will discover numerous contrasts between MVC 5 and ASP.NET Core 1.0. This article
specified the imperative new components/ideas that you have to comprehend to start your voyage with
ASP.NET Core 1.0.
We the institute provide training in dot net field to freshers to know the reviews
about our company visit crb tech reviews.
Related Articles:
8 Killer Techniques To Learn .NET
Top 5 Reasons That Make ASP.NET More Secure Over PHP

Weitere ähnliche Inhalte

Andere mochten auch

Are timesheets money sheets by Frank Verleg
Are timesheets money sheets by Frank VerlegAre timesheets money sheets by Frank Verleg
Are timesheets money sheets by Frank VerlegVitor Pereira
 
Creating an nuget package for EPiServer
Creating an nuget package for EPiServerCreating an nuget package for EPiServer
Creating an nuget package for EPiServerPaul Graham
 
BANCO CENTRAL - PMI Implantando uma Visão Integrada de Gestão
BANCO CENTRAL - PMI Implantando uma Visão Integrada de GestãoBANCO CENTRAL - PMI Implantando uma Visão Integrada de Gestão
BANCO CENTRAL - PMI Implantando uma Visão Integrada de GestãoEloGroup
 
Проект "Чорнобривці - квіти сонця"
Проект "Чорнобривці - квіти сонця"Проект "Чорнобривці - квіти сонця"
Проект "Чорнобривці - квіти сонця"Natali Natali
 
Academy PRO: ASP .NET Core MVC
Academy PRO: ASP .NET Core MVCAcademy PRO: ASP .NET Core MVC
Academy PRO: ASP .NET Core MVCBinary Studio
 
ScaleUp Airbnb - จับเสือมือเปล่า
ScaleUp Airbnb - จับเสือมือเปล่าScaleUp Airbnb - จับเสือมือเปล่า
ScaleUp Airbnb - จับเสือมือเปล่าDNTMb Inc.
 
Human values &amp; professional ethics bm 226
Human values &amp; professional ethics bm 226Human values &amp; professional ethics bm 226
Human values &amp; professional ethics bm 226Qazi Ahmad
 

Andere mochten auch (10)

Are timesheets money sheets by Frank Verleg
Are timesheets money sheets by Frank VerlegAre timesheets money sheets by Frank Verleg
Are timesheets money sheets by Frank Verleg
 
Creating an nuget package for EPiServer
Creating an nuget package for EPiServerCreating an nuget package for EPiServer
Creating an nuget package for EPiServer
 
оаам л5
оаам л5оаам л5
оаам л5
 
BANCO CENTRAL - PMI Implantando uma Visão Integrada de Gestão
BANCO CENTRAL - PMI Implantando uma Visão Integrada de GestãoBANCO CENTRAL - PMI Implantando uma Visão Integrada de Gestão
BANCO CENTRAL - PMI Implantando uma Visão Integrada de Gestão
 
Проект "Чорнобривці - квіти сонця"
Проект "Чорнобривці - квіти сонця"Проект "Чорнобривці - квіти сонця"
Проект "Чорнобривці - квіти сонця"
 
Academy PRO: ASP .NET Core MVC
Academy PRO: ASP .NET Core MVCAcademy PRO: ASP .NET Core MVC
Academy PRO: ASP .NET Core MVC
 
ScaleUp Airbnb - จับเสือมือเปล่า
ScaleUp Airbnb - จับเสือมือเปล่าScaleUp Airbnb - จับเสือมือเปล่า
ScaleUp Airbnb - จับเสือมือเปล่า
 
การพัฒนาคุณภาพจากการทบทวน
การพัฒนาคุณภาพจากการทบทวนการพัฒนาคุณภาพจากการทบทวน
การพัฒนาคุณภาพจากการทบทวน
 
Human values &amp; professional ethics bm 226
Human values &amp; professional ethics bm 226Human values &amp; professional ethics bm 226
Human values &amp; professional ethics bm 226
 
pi936.pdf
pi936.pdfpi936.pdf
pi936.pdf
 

Mehr von sonia merchant

What does dot net hold for 2016?
What does dot net hold for 2016?What does dot net hold for 2016?
What does dot net hold for 2016?sonia merchant
 
What does .net hold for 2016?
What does .net hold for 2016?What does .net hold for 2016?
What does .net hold for 2016?sonia merchant
 
Data protection api's in asp dot net
Data protection api's in asp dot netData protection api's in asp dot net
Data protection api's in asp dot netsonia merchant
 
Authorization in asp dot net part 2
Authorization in asp dot net part 2Authorization in asp dot net part 2
Authorization in asp dot net part 2sonia merchant
 
Asp dot-net core problems and fixes
Asp dot-net core problems and fixes Asp dot-net core problems and fixes
Asp dot-net core problems and fixes sonia merchant
 
Search page-with-elasticsearch-and-dot-net
Search page-with-elasticsearch-and-dot-netSearch page-with-elasticsearch-and-dot-net
Search page-with-elasticsearch-and-dot-netsonia merchant
 
Build a-search-page-with-elastic search-and-dot-net
Build a-search-page-with-elastic search-and-dot-netBuild a-search-page-with-elastic search-and-dot-net
Build a-search-page-with-elastic search-and-dot-netsonia merchant
 
How to optimize asp dot-net application
How to optimize asp dot-net applicationHow to optimize asp dot-net application
How to optimize asp dot-net applicationsonia merchant
 
How to optimize asp dot net application ?
How to optimize asp dot net application ?How to optimize asp dot net application ?
How to optimize asp dot net application ?sonia merchant
 
Learn dot net attributes
Learn dot net attributesLearn dot net attributes
Learn dot net attributessonia merchant
 
Learn about dot net attributes
Learn about dot net attributesLearn about dot net attributes
Learn about dot net attributessonia merchant
 
Owin and-katana-overview
Owin and-katana-overviewOwin and-katana-overview
Owin and-katana-overviewsonia merchant
 
Top 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answersTop 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answerssonia merchant
 
Next generation asp.net v next
Next generation asp.net v nextNext generation asp.net v next
Next generation asp.net v nextsonia merchant
 
Dot net universal apps
Dot net universal appsDot net universal apps
Dot net universal appssonia merchant
 
Browser frame building with c# and vb dot net
Browser frame building  with c# and vb dot netBrowser frame building  with c# and vb dot net
Browser frame building with c# and vb dot netsonia merchant
 
A simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-frameworkA simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-frameworksonia merchant
 

Mehr von sonia merchant (20)

What does dot net hold for 2016?
What does dot net hold for 2016?What does dot net hold for 2016?
What does dot net hold for 2016?
 
What does .net hold for 2016?
What does .net hold for 2016?What does .net hold for 2016?
What does .net hold for 2016?
 
Data protection api's in asp dot net
Data protection api's in asp dot netData protection api's in asp dot net
Data protection api's in asp dot net
 
Authorization p iv
Authorization p ivAuthorization p iv
Authorization p iv
 
Authorization iii
Authorization iiiAuthorization iii
Authorization iii
 
Authorization in asp dot net part 2
Authorization in asp dot net part 2Authorization in asp dot net part 2
Authorization in asp dot net part 2
 
Asp dot-net core problems and fixes
Asp dot-net core problems and fixes Asp dot-net core problems and fixes
Asp dot-net core problems and fixes
 
Search page-with-elasticsearch-and-dot-net
Search page-with-elasticsearch-and-dot-netSearch page-with-elasticsearch-and-dot-net
Search page-with-elasticsearch-and-dot-net
 
Build a-search-page-with-elastic search-and-dot-net
Build a-search-page-with-elastic search-and-dot-netBuild a-search-page-with-elastic search-and-dot-net
Build a-search-page-with-elastic search-and-dot-net
 
How to optimize asp dot-net application
How to optimize asp dot-net applicationHow to optimize asp dot-net application
How to optimize asp dot-net application
 
How to optimize asp dot net application ?
How to optimize asp dot net application ?How to optimize asp dot net application ?
How to optimize asp dot net application ?
 
10 things to remember
10 things to remember10 things to remember
10 things to remember
 
Learn dot net attributes
Learn dot net attributesLearn dot net attributes
Learn dot net attributes
 
Learn about dot net attributes
Learn about dot net attributesLearn about dot net attributes
Learn about dot net attributes
 
Owin and-katana-overview
Owin and-katana-overviewOwin and-katana-overview
Owin and-katana-overview
 
Top 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answersTop 15-asp-dot-net-interview-questions-and-answers
Top 15-asp-dot-net-interview-questions-and-answers
 
Next generation asp.net v next
Next generation asp.net v nextNext generation asp.net v next
Next generation asp.net v next
 
Dot net universal apps
Dot net universal appsDot net universal apps
Dot net universal apps
 
Browser frame building with c# and vb dot net
Browser frame building  with c# and vb dot netBrowser frame building  with c# and vb dot net
Browser frame building with c# and vb dot net
 
A simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-frameworkA simplest-way-to-reconstruct-.net-framework
A simplest-way-to-reconstruct-.net-framework
 

Kürzlich hochgeladen

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 

Kürzlich hochgeladen (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

For mvc developers the features of asp.net core

  • 1. FOR MVC DEVLEOPERS THE FEAUTURES OF ASP.NET CORE ASP.NET Core 1.0 gives a patched up Web development system adapted towards the prerequisites of present day Web applications. The new structure, as of now in RC1, obliges you to learn numerous new ideas not found in ASP.NET MVC 5. To that end, this article identifies a couple of essential components that ASP.NET MVC 5 designers ought to know as they get ready to take in this new structure. 1. ASP.NET Core on Numerous Runways ASP.NET Core is a piece of .NET Core—another measured structure that backings numerous stages.ASP.NET and the .NET framework are focused on towards the Windows stage. Then again, ASP.NET Core is created to bolster various stages including Windows, Mac, and Linux. This additionally implies, dissimilar to ASP.NET web applications, basically, keep running under IIS, the ASP.NET Core applications can keep running under non-IIS Web servers. Figure 1 demonstrates the part of the .NET Core and ASP.NET Core.
  • 2. The part of the .NET Core and ASP.NET Core - A Web application worked with ASP.NET Core can target ASP.NET Framework 4.6 or the ASP.NET Core. The Web applications focusing on ASP.NET Framework 4.6 run just on the Windows stage. The Web applications focusing on the ASP.NET Core can keep running on Windows and non-Windows stages. Obviously, as on this composition, ASP.NET Core doesn't offer the same rich usefulness offered by ASP.NET Framework 4.6. 2. Part of Project.json ASP.NET Core utilizes an exceptional document—Project.json for putting away all the undertaking level configuration data. Project.config can store numerous design settings, for example, references to NuGet bundles utilized as a part of the task and target structures. "dependencies": { "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final", "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final", "Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final", "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", "EntityFramework.Commands": "7.0.0-rc1-final", "Microsoft.AspNet.Session": "1.0.0-rc1-final", "Newtonsoft.Json": "8.0.3" The Project.json record stores configuration data in JSON position. The above markup demonstrates a conditions segment that contains a rundown of NuGet bundles required by the application. For instance, the Web application under thought requires the 6.0.0-rc1-last form of Microsoft.AspNet.Mvc get together, etc 3. Part of AppSettings.json ASP.NET stores application configuration settings in Web.config. For instance, engineers utilize the <appSettings> area to store custom application settings, the <connectionStrings> segment to store database association strings, etc. ASP.NET Core utilizes AppSettings.json to store such bits of data. Consider the accompanying configuration: { "AppSettings": { "Title": "My ASP.NET Core Application" },
  • 3. "Data": { "DefaultConnection": { "ConnectionString": "data source=.; initial catalog=Northwind;integrated security=true" } } } The previous JSON markup comprises of two properties or keys, to be specific AppSettings and Data. The AppSettings property holds a sub-key named Title. The Title sub-key has a string estimation of "My ASP.NET Core Application". Also, the Data key has a DefaultConnection sub-key. The DefaultConnection thusly has a ConnectionString sub-key. 4. Application set-up In ASP.NET, Global.asax goes about as the passage point for your application. You can wire different events handlers for occasions, for example, Application_Start and Session_Start, in the Global.asax record. In ASP.NET Core, the application startup happens in an unexpected way— it happens through a Startup class. one such Startup class - public class Startup { public Startup(IHostingEnvironment env, IApplicationEnvironment app) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.SetBasePath(app.ApplicationBasePath); builder.AddJsonFile("appsettings.json"); IConfigurationRoot config = builder.Build(); string str = config.Get<string> ("Data:DefaultConnection:ConnectionString"); // do something with str } public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddEntityFramework() .AddSqlServer(); } public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); app.UseMvc(routes =>
  • 4. { routes.MapRoute( name: "default", template: "{controller=Home}/ {action=Index}/{id?}"); }); } public static void Main(string[] args) => WebApplication.Run<Startup>(args); } The Startup class appeared above starts with a constructor. The constructor stacks the AppSettings.json record utilizing ConfigurationBuilder class. The Get() strategy then is utilized to peruse the database association string put away in the AppSettings.json document. The ConfigureServices() technique includes the administrations required by the application. For instance, here you add MVC and Entity Framework to the administrations gathering. The Configure() technique determines and arranges the administrations included before for application's utilization. For instance, the MVC directing is designed in the code appeared previously. 5. Tag Helpers In ASP.NET MVC 5, you utilized HTML assistants, for example, BeginForm(), LabelFor(), and TextBoxFor() to render structures and frame fields. You can keep on using HTML partners in ASP.NET Core, too. However, there is a superior option: Tag Helpers. Label aides take the type of standard HTML labels with certain extraordinary asp-* credits added to them. Consider the accompanying markup that renders a structure: <form asp-controller="Home" asp-action="Save" method="post"> <table border="1" cellpadding="10"> <tr> <td><label asp-for="FirstName">First Name :</label></td> <td><input type="text" asp-for="FirstName" /></td> </tr> <tr> <td><label asp-for="LastName">Last Name :</label></td> <td><input type="text" asp-for="LastName" /></td> </tr> <tr> <td><label asp-for="Email">Email :</label></td> <td><input type="text" asp-for="Email" /></td>
  • 5. </tr> <tr> <td><label asp-for="Phone">Phone :</label></td> <td><input type="text" asp-for="Phone" /></td> </tr> <tr> <td colspan="2"> <input type="submit" value="Submit" /> </td> </tr> </table> </form> Observe clearly, the properties that start with asp-. They are characterized by the label aides. For instance, the structure label aide utilizes asp-controller ascribe to indicate the objective controller name and asp-activity credit to determine the objective activity technique name. Correspondingly, asp-for traits utilized with name and info label partners tie a name or a text box to a model property. Label partners are more advantageous to use than HTML assistants in light of the fact that their linguistic structure nearly takes after the HTML markup. 6. View Components In MVC 5, you utilized halfway perspectives as a way to reuse markup and code. ASP.NET Core presents View Components, the more intense and adaptable option. A perspective part comprises of a class normally acquired from ViewComponent base class and a perspective record containing the required markup. This programming model is entirely like the one utilized by controllers and perspectives. It permits you to separate code and markup from each other— code in the perspective segment class and markup in a perspective. Once made, you can utilize a perspective segment on a perspective by utilizing the @Component.Invoke() technique. 7. Dependency Injection ASP.NET Core gives an inbuilt reliance infusion system. The DI system of ASP.NET Core offers four-lifetime modes for a sort being infused: Singleton: An object of an administration (the sort to be infused) is made and supplied to all the requests to that administration. Along these lines, fundamentally all requests get the same article to work with. Scoped: An object of an administration is made for every single request. In this way, every request gets another event of an administration to work with. Transient: An object of an administration is made each time an article is asked. Instance: For this situation, you are in charge of making an object of an administration. The DI system then uses that case in singleton mode said prior public void ConfigureServices(IServiceCollection services)
  • 6. { services.AddMvc(); services.AddSingleton<IMyService,MyService>(); } Here, MyService is the sort to be enlisted with the DI structure and actualizes IMyService. The AddSingleton() technique enlists this type for Singleton mode portrayed previously. Once a sort is enrolled with the DI system, you can infuse it in a controller like this: public class HomeController : Controller { private IMyService obj; public HomeController(IMyService obj) { this.obj = obj; } .... .... } 8. Gulp, Grunt, and Bower Support Gulp and Grunt are JavaScript assignment runners. They help you computerize generally required undertakings, for example, packaging JavaScript and CSS records, minifying JavaScript and CSS documents, and arranging Less and Sass records (and some more). They are introduced utilizing npm (Node Package Manager). The ASP.NET Core venture made utilizing Visual Studio 2015 permits you to include Grunt and Gulp arrangement documents furthermore gives Task Runner Explorer to screen the errands. Bower is a bundle administrator basically for front-end bundles. Front-end bundles are the bundles that you use in your Web pages, for example, JavaScript libraries/systems and CSS records. For instance, you may introduce jQuery in your ASP.NET Core venture by utilizing Bower. An ASP.NET Core venture made utilizing Visual Studio 2015 permits you to include a Bower setup document. You likewise can work with the bundles utilizing the Manage Bower Packages menu choice. 9. Single Programming for Web API Model for and MVC In MVC 5, controllers acquire from the System.Web.Mvc.Controller base class. What's more, Web API 2 controllers acquire from System.Web.Http.ApiController. In ASP.NET Core, both of these structures are converged into a solitary system. Therefore, under ASP.NET Core, an MVC controller and Web API controller both acquire from Microsoft.AspNet.Mvc.Controller base class. You then can design viewpoints, for example, HTTP verb mapping and the directing of the controllers as coveted. 10. Static Files and the wwwroot Folder
  • 7. In ASP.NET, there is no settled area for putting away static documents, for example, picture records, JavaScript documents, and CSS records (engineers regularly utilized a Content envelope to store such documents). In ASP.NET Core, all the static records are kept under the wwwroot envelope (default). You likewise can change the name of this envelope by utilizing the Project.json document. Refer the figure following down - After arrangement, the wwwroot turns into the Web application's root. Every one of the URLs to static records are determined as for this envelope. Along these lines,/pictures/logo.png anticipates that logo.png will be available under the wwwroot/pictures envelope. Conclusion - ASP.NET Core 1.0 is a redone system outfitted towards present day cloud based, measured Web applications. Despite the fact that the new structure safeguards the key ideas of MVC 5, ASP.NET engineers will discover numerous contrasts between MVC 5 and ASP.NET Core 1.0. This article specified the imperative new components/ideas that you have to comprehend to start your voyage with ASP.NET Core 1.0. We the institute provide training in dot net field to freshers to know the reviews about our company visit crb tech reviews. Related Articles: 8 Killer Techniques To Learn .NET Top 5 Reasons That Make ASP.NET More Secure Over PHP