(CORE) CORE (2024)

Migration ASP.NET to NET Core 8 (including EF6 to EF Core)

If we looking to Microsoft documentation Upgrade from ASP.NET Framework to ASP.NET Core we find out just only empty space in most important parts of EF6 documentation.

And moreover, all ASP.NET MVC library Microsoft marked as vulnerable, unsupported and legacy.



Even if something library not marked by Microsoft as unsupported and legacy, restoring packages require NET Framework, this is destroy all job to migration.



This is point I want to discuss in this page.


So, migration ASP.NET MVC to ASP.NET Core usually contains two parts. First parts is migration ASP.NET MVC pages.

1. Migrate ASP.NET pages project.

What problem we have with Microsoft? Just only one problem - Microsoft working against programmers and end-customers, just following for own policy to increase price of software and increase sales of own products. I already write a lot of post about this, for example Why Microsoft vilified Visual Basic ? - nothing worried Microsoft except increase of sales MS SQL server and increase price of any software based on MS platform.

You must understand this, before reading more. This is a one simple reason why Microsoft refuse to support Visual Basic, because Visual Basic is more extended language than C#, and this is reason of all Microsoft trash you will see below.

So, what Microsoft doing to make programming more unpredictable, more sophisticated and more difficult. What way Microsoft used to allow 10 programmers doing the same job as 1 programmer successfully done before? Do you think that forbid VB.NET is enough? No, of course, no!

Microsoft in each new version moving each element of puzzle from one library to another, for example in screen below Microsoft moving JSON from one library to another and change each possible parameters of any Microsoft function, for example in new version JsonRequestBehavior.AllowGet parameter forbidden and JsonResult also present in current namespace, but we need to add additionally library and change namespace to another library in new NET Core 8 version manually.

Microsoft permanently changed each parameters in each their function, for example Response in previous version contains property Buffer, but in new version - this property missing, of course in nex version NET Core 9 this parameter apears again, but in another namespace - not inside Response namespase, in some new and unpredictable space. That is what Microsoft doing - moving various parameters from one library to another, sometimes hides that parameters from users, than again make it public.

Look at this, please:



Microsoft changed parameters in any possible place. I'm sure - if Microsoft would doing only one browser for whole world, Microsoft will rename in each new browser version tag Body to Div, tag Div to Span, tag Span to Options and round up this rename in each new browser version.

Look at this, please, even Label has different syntax in MVC and NET Core.



AS I mention, main Microsoft job to increase software price is permanently rename one interface/class to another (and in next future version rename backward), for example rename HttpPostedFileBase to IformFile.



Cool result can receive Microsoft if some convenient parameters unexpectedly disappears, for example JsonRequestBehavior.AllowGet.



Other workflow used by Microsoft is changing order of parameters, if there is no room to changing or adding MS just adding empty parameter inside existing list of parameters, for example in this case in tag FORM Microsoft just adding additional empty parameter in parameter list.



But, as I mention, best way is just permanently rename one class to another, for example class what we used to upload string to html tag Select:



Because many sites use Microsoft Authentication, the best way to make damage for developers and customers is permanently changing various Authentication properties, for example delete fields AuthenticationDescription.



And, of course, fully changed code related to OWIN authentication. Only one this changing induce full rewriting page part related with UserLogged utility.



And finally, some positive recipe. This is ASP NET CORE 8 project file we need to create ASP NET CORE 8 project.



This is services we need to configure in DI container, because in ASP.NET MVC we don't need DI container, all was working fine without this one. We need to configure database access, for example this is PostgreSQL access:



This is JSON serializations:



And this is CORS tuning (but from another project, this project can not CORS tuning):



2. Migrate EF6 Core first database access project.

As I mention, all Microsoft efforts is applied to increase MS SQL server sales, for doing this MS said - we support only MS SQL, and other SQL server companies PostgreSQL/SqLite/MySQL must care about himself. In practice this means that only MS SQL has properly supported by EF. For example PostgreSQL function not supported at all in EF Core first.



Commonly EF6 used resources that stored in DLL, for example.



But EF Core does not used this approach, EF Core used repository interfaces like this



If we use just only MS SQL server, we can import DB definition from *.TT declaration.



And, of course, we need to redefine manually primary key for each table and other various restriction.



And than we can use onModelCreating to clarify model (insert relation between tables with Fluent API) or redefine static attributes in model



But for PostgreSQL function we need manually rewrite all functions with Database with ExecuteRawSQL. This is just stub I used before I have write all request to DB with ExecuteRawSQL.



So, as you can see - migration from ASP.NET MVC to ASP.NET Core is possible, but Microsoft applied extraordinary efforts to insert difficulties to migration process.



Comments ( )
Link to this page: http://www.vb-net.com/AspNetMigration/Index.htm
< THANKS ME>