A while ago ASP.NET Core came (the latest
version is 2.0.2) and has a completely disjoint architecture that allows
integration of components as needed by the application. It is much more lightweight
than its predecessor, and enables easy-to-use data access for ASP.NET Core. You
can build asp.net applications on a mac
or Linux.
Asp.net core supports Self-contained deployment; this means the whole
core framework can be a part of the deployment package. This enables deploying
only any machine. For a complete list of runtime identifiers can be found here.
The new Core framework runs on any machine, is Open-source and community-focused and can be built on the cloud, one more less important thing is, complex apps do not need Visual Studio and can be developed with any free IDE and CLI. Also there is ability to host on IIS or self-host in your own process.
The new Core framework runs on any machine, is Open-source and community-focused and can be built on the cloud, one more less important thing is, complex apps do not need Visual Studio and can be developed with any free IDE and CLI. Also there is ability to host on IIS or self-host in your own process.
Entity Framework (EF) Core is a
lightweight, extensible, and cross-platform version of the popular Entity
Framework data access technology.
Read more about Entity Framwork Core.
EF core can run with a number of databases, it also supports NoSql Databases.
See the EF Core
Roadmap. CosmosDb provider will come out soon, and databases line
mongodb and ravendb will be supported in
the near future.
But there are some other providers for entity framework. For example to use mongodb with EF core you can use https://github.com/crhairr/EntityFrameworkCore.MongoDb . EFCore-MongoDb wraps the MongoDb C# Driver and supports the driver's attributes and conventions.
But there are some other providers for entity framework. For example to use mongodb with EF core you can use https://github.com/crhairr/EntityFrameworkCore.MongoDb . EFCore-MongoDb wraps the MongoDb C# Driver and supports the driver's attributes and conventions.
Before going ahead, ask the question-> how
does this help? Core is the next .NET Framework, there’s no seamless transition
to the new ASP.NET version, and there has been a change in the whole
architecture of how .NET applications are built. Most importantly ASP.NET Core
is free and open
source. This means that there is no need to buy enterprise Visual
Studio license, this lessens the development cost and EF Core eliminates
the need for most of the data-access code that developers usually need to
write. The other notable
difference is that development or deployment of ASP.NET Core applications can
be done on any Operating system or Cloud.
EF core allows a set of database providers such
as MS Sql, Oracle, Postgres etc. to be
configured.
Individual database support is often handled by
a different set of classes that are imported only when needed.
Lets get
some code running.
Create a console app from core:
In the below example Ive used dotnet core 2.0.0 sdk that can be downloaded from here and vscode as the IDE that can be downloaded from here by selecting your OS and System. Note that VS code is a good option for ASP.NET Core; Other Editors such as Sublime Brackets or any other editor including Visual Studio 2017 (only 2017 supports Core) can be used.
In the below example Ive used dotnet core 2.0.0 sdk that can be downloaded from here and vscode as the IDE that can be downloaded from here by selecting your OS and System. Note that VS code is a good option for ASP.NET Core; Other Editors such as Sublime Brackets or any other editor including Visual Studio 2017 (only 2017 supports Core) can be used.
Make sure you have installed dotnet core sdk. To check open
command line and
Create a directory and navigate into it
To create a new mvc project use the new command with the mvc
option. A new mvc project is created in the folder and the dependencies are
restored.
To run this project just type dotnet run, this will start
the application
On navigating to http://localhost:5000 you should see
the new mvc site.
Make sure Visual Studio code is installed. Install VScode
from here
Open the project just created using VS code by typing ‘ code
.’
You should have VS Code opened the project
Next install the C# Extension
This will allow you to have intellisence within a c# file.
Another
extension is needed to install nuget packages
One thing
in aspnet core is that you will be able to edit the .csproj file