CYQ. Data officially supports the release of DotNET Core, cyq. datadotnet

Source: Internet
Author: User
Tags unsupported

CYQ. Data officially supports the release of DotNET Core, cyq. datadotnet
Gossip:

Since last week, the IOS staff have passed away and started to take over the IOS code.

And began to organize the IOS code (including the development framework designed at that time ).

In the not-to-be-distant future, we imagine that there will be a series of detailed introduction to the Technology series involved in the I-love App and IT connection App, as well as the front-end and back-end.

At the same time, we are also preparing to release an IOS development framework to add another member for the twelve constellations.

The idle talk is over. Let's look at the text below:

CYQ. Data supports DotNet Coe tossing process:

About last Friday, after submitting CYQ. Data V5.5.8.1 to Nuget, I watched drive C still have 7 GB of hair for a while.

Then I made a decision to uninstall VS2015, and now the C disk has 10 Gb.

On the Microsoft official website, I downloaded the Community version and installed VS2017. Fortunately, I can select components and select only. NET Core-related components. I will finish the process with more than 5G components.

 

After the installation, create a class library project and Copy the entire source code. The dependencies are the places where we usually reference the dll:

Start coding and witness the miracle: a bunch of errors.

 

Fortunately, VS2017 is very user-friendly in terms of error prompts. It shows you the number of errors in batches, so that you can solve them in batches.

Unlike when I was tossing. NET Core 1.1 in VS2015, there were hundreds of errors at once, and Liang jingru could not save you.

Faced with errors: how to handle and support Dotnet Core? When tossing. NET Core 1.1:

At that time, the source code of CYQ. Data was reorganized once, And all unsupported sources were extracted separately.

In this way, for example, serialization is not supported at that time, and all serialized objects are extracted and put into a file:

A class is usually divided into several partial categories (unsupported for exclusion)

 

Good idea:

By excluding some folders, you do not need to maintain two pieces of code.

However:

In order to remove folders, you can also compile and complete the Oracle solution. Some of them are strongly related and services are organized, which is surprisingly heavy.

Some code must be changed to dynamic calls for reflection to ensure that the file separation is normal.

The key is that there were too many missing class libraries in those versions at that time. After a few days, I put them down and turned back to the database.

Tossing. NET Core 2.0:

1: I want to write a mini version.

But it is not that simple. It requires passion and a lot of time. It is not easy to satisfy these conditions at the same time.

At the same time, it means that there is more than one framework to be maintained. Although the number of frameworks I have maintained is too large, there is not more than one.

Time is not enough for serious people !!!

 

2: solves version support problems through incremental Methods

As mentioned above, when tossing. NET Core 1.1, it is intended to solve the problem through elimination of reduction, and the result cannot be reached.

Let's move things around and look back. The way to solve the problem is so clever and wonderful.

This is a matter of course, and I want to use incremental methods to solve the problem.

How does CYQ. Data support. NET Core through incremental code?

For a class with no prompts, when you place the cursor in the VS environment, there will be a prompt refactoring, which can reduce the workload.

1: Re-generate a class file for every unsupported class, method, or attribute in the form of reconstruction and sort it out with the corresponding namespace.

In this way, sort out class libraries that do not support differentiation, and you can also clearly know which classes referenced in the framework are not available in. NET Core.

Then, the compilation passes smoothly.

 

2: rewrite the implementation of the new class library. For example, rewrite the read configuration file:

using CYQ.Data;using System.IO;using CYQ.Data.Tool;using System.Collections.Specialized;namespace System.Configuration{    internal class ConfigurationManager    {        static string appSettingJson = string.Empty;        static ConfigurationManager()        {            string filePath = AppConfig.WebRootPath + "appsettings.json";            if (System.IO.File.Exists(filePath))            {                appSettingJson = File.ReadAllText(filePath, Text.Encoding.UTF8);                if (!string.IsNullOrEmpty(appSettingJson))                {                    appSettingJson = appSettingJson.Replace("\\\\", "\\");                }            }        }        private static NameValueCollection _AppSettings;        public static NameValueCollection AppSettings        {            get            {                if (_AppSettings == null && !string.IsNullOrEmpty(appSettingJson))                {                    string settingValue = JsonHelper.GetValue(appSettingJson, "appsettings");                    if (!string.IsNullOrEmpty(settingValue))                    {                        _AppSettings = JsonHelper.ToEntity<NameValueCollection>(settingValue);                    }                }                if (_AppSettings == null)                {                    return new NameValueCollection();                }                return _AppSettings;            }        }        private static ConnectionStringSettingsCollection _ConnectionStrings;        public static ConnectionStringSettingsCollection ConnectionStrings        {            get            {                if (_ConnectionStrings == null)                {                    _ConnectionStrings = new ConnectionStringSettingsCollection();                    if (!string.IsNullOrEmpty(appSettingJson))                    {                        string settingValue = JsonHelper.GetValue(appSettingJson, "connectionStrings");                        if (!string.IsNullOrEmpty(settingValue))                        {                            NameValueCollection nv = JsonHelper.ToEntity<NameValueCollection>(settingValue);                            if (nv != null && nv.Count > 0)                            {                                foreach (string key  in nv.Keys)                                {                                    ConnectionStringSettings cs = new ConnectionStringSettings();                                    cs.Name = key;                                    cs.ConnectionString = nv[key];                                    _ConnectionStrings.Add(cs);                                }                            }                        }                    }                }                               return _ConnectionStrings;            }        }    }}  

Configuration files and System. Web are frequently used.

Reading the configuration file is troublesome for System. Web. You need to reference Microsoft. AspNetCore on Nuget:

 

After the reference, rewrite the content. The specific content will not be pasted here. For the code, see the source code.

Due to the temporary concentrated processing over the past two days, I have just completed the processing and only conducted a simple MSSQL test.

So it's too late to release Nuget. I will write the text first, and wait for the day when the test is stable before going to Nuget.

CYQ. Data supports. NET Core:

1: Download the source code of CYQ. Data from GitHub (an additional folder will be found)

Address: https://github.com/cyq1162/cyqdata

 

Because you have not submitted a solution file to directly run the project, you need to create a class library project in advance:

2: create a new class library project named CYQ. Data. Copy the source code (including DotNetCore)

3: Microsoft. AspNetCore is referenced on Nuget.

Compile the program, and then you will be able to reference the class library project in your. NET Core project.

If Web is involved, two injection points are required:

Call app. UseStaticHttpContext () in the MVC project (). Public void Configure (IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {app. useStaticHttpContext ();.....} in a project without HttpContextAccessor injection, you also need to call services in the ConfigureServices method. addHttpContextAccessor ();

 

 

Summary:

A weekend, a coincidence, a continuous passion.

CYQ. Data's. NET Core support has come to an end.

The test of MSSQL is basically passed, and the rest is easy to say !!!

Taurus. MVC is still Aries. It is estimated that it is not far from supporting. NET Core.

 

However, the next step is to enter the IT connection startup status.

There have been a lot of thoughts on IT connections recently, combined with suggestions from some netizens.

It is inevitable that there will be another wave of questions about product optimization and trend.

In addition, there is still an article missing from the operation, which must be added later.

Finally, I would like to thank you for your attention !!!

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.