ASP. NET 5 Core and iBoxDB package Management Quick Start example on Linux, iboxdb Quick Start

Source: Internet
Author: User

ASP. NET 5 Core and iBoxDB package Management Quick Start example on Linux, iboxdb Quick Start

ASP. an important update of NET 5 is that it supports running in. NET Execution Environment (DNX. DNX Core currently supports three operating systems Windows Ubuntu OSX, although Mono on Linux. NET supports very well, but it is worth a try to introduce convenient package management in DNX. Java jar packages do not have built-in version numbers. You can put them together. NET dll packages with version numbers. When they are put together, the version numbers may conflict with each other.

It is also very convenient to configure DNX on Ubuntu Linux. The traditional. NET installation method that does not need to be downloaded from the website and then executed, is of course not as convenient as the modern APP store. For details, refer to the official website. Copy the command line here and execute it on Ubuntu.

Sudo sh-c 'echo "deb [arch = amd64] http://apt-mo.trafficmanager.net/repos/dotnet/ trusty main">/etc/apt/sources. list. d/dotnetdev. list'

Sudo apt-key adv -- keyserver apt-mo.trafficmanager.net -- recv-keys 127a0893

Sudo apt-get update

Sudo apt-get install dotnet

After executing these commands, you will have a dotnet environment. Here, you must mention mono-complete. When new databases are dizzy on the DNX Core platform, don't forget there is another Mono. This is the help of the DNXCore API. If it is incompatible, it must be checked. The most frequently found information is the Assembly name. Advanced package management is introduced in DNX Core, but you need to load the version number yourself.

In the previous install dotnet, it only installs some basic runtime environments, so it is very fast. Start the test below. Create an empty directory named dnxcore.

Dotnet init

This directory contains a Hello World template. Traditional. NET Program only has Program. cs is a file, and a project is added to DNX. json file. This file is used to load packages as needed. Generally, You need to modify the dependencies section and add iBoxDB to it. the DNX 2.6.2.16 package references FileSystem and Thread. In DNX, basic functions such as file operations and thread classes are all in a separate package.

"dependencies": {  "Microsoft.NETCore.Runtime": "1.0.1-beta-*",  "System.IO": "4.0.11-beta-*",  "System.Console": "4.0.0-beta-*",  "System.Runtime": "4.0.21-beta-*",  "iBoxDB.DNX": "2.6.2.16",  "System.IO.FileSystem" : "4.0.1-*",  "System.Threading.Thread" : "4.0.0-*",  "System.Threading.Tasks.Parallel" : "4.0.0-*"}

In this case, make sure that the network connection is normal and then run

Dotnet restore

Wait for it to automatically load online. At last, you may be prompted that some basic libraries are not found. This is because Microsoft. NETCore. runtime is a version change of the basic Runtime package. It references the package Microsoft. NETCore. runtime. the CoreCLR version changes, while Microsoft. NETCore. runtime. the version of the packages referenced by the CoreCLR package will also change. A large number of packages are beta versions and are often upgraded. It is not easy to set the correct version in an environment where the formal package and Beta are mixed, I just don't set these systems. * packages are loaded by default. And traditional. NET Framework released a new version in Year 12. The DNXCore package is updated once a few weeks, and updated in several active days. developers who like to always reference the latest version may be excited. You can also remove Microsoft. NETCore. Runtime and manage the version of the basic package by yourself. As follows:

"dependencies": {  "System.Collections" : "4.0.10",  "System.Reflection" : "4.0.10",  "System.Reflection.Extensions" : "4.0.0",  "System.Runtime.Extensions" : "4.0.10",  "System.Text.Encoding" : "4.0.10",  "System.Globalization" : "4.0.10",  "System.Threading" : "4.0.10",  "System.IO": "4.0.11-beta-*",  "System.Console": "4.0.0-beta-*",  "System.Runtime": "4.0.21-beta-*",  "iBoxDB.DNX": "2.6.2.16",  "System.IO.FileSystem" : "4.0.1-*",  "System.Threading.Thread" : "4.0.0-*",  "System.Threading.Tasks.Parallel" : "4.0.0-*",}

Dotnet restore does not place a bunch of downloaded files in the directory of the newly created project file, but in the. dnx/packages directory of the user's Home. The iBoxDB. DNX package directory contains a test file. Run the following command to copy the file to the current directory:

@ Ubuntu :~ /Dnxcore $ cp ../. dnx/packages/iBoxDB. DNX/2.6.2.16/content/iBoxDB26.cs.

Open Program. cs and copy the previous two lines of Test Call code.

public class Program{   public static void Main(string[] args)  {     iBoxDB.LocalServer.DB.Root("/tmp/");     Console.WriteLine(iBoxDB.TestHelper.RunALL());  }}

Last executed

Dotnet run

You can see the effect without compiling. If you do not want to type a line of code, you can download the test code here. The dnxcore5 operation is the same as the one used in Windows and Ubuntu, that is, the command line is also typed in Windows. Which of the following is the best performance? Guess? Of course, all the good code is stored in the Windows version. Here, I will mention Mono again. Most applications do not use up the CPU, so you can choose to deploy the Platform Based on your actual situation and automatically load the associated packages. These are good features.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.