How to Migrate from .NET to .NET 5 Controls

Microsoft’s primary goal with the release of .NET 5.0 is to merge all future .NET development onto one unified .NET platform. All of Microsoft’s different development environments, such as WinForms, WPF, ASP. NET, Xamarin, etc. are all moving to .NET Core, which will now be known as “.NET.”

.NET 5.0 is technically .NET 5.0 Core, but 5.0 intends to clean up and simplify the terminology for future development in .NET. The version number is skipping straight from 3.0 to 5.0 to prevent confusion due to .NET Framework using the 4.x version numbering for quite some time now. After .NET 5.0, Microsoft’s roadmap shows that they plan to keep the versioning simple with yearly major releases every November going from 5.0 to 6.0 to 7.0, and so on.

#.NET #Desktop

What is GEEK

Buddha Community

How to Migrate from .NET to .NET 5 Controls
Einar  Hintz

Einar Hintz

1602560783

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

To demonstrate CRUD operations – insert, update, delete and retrieve, the project will be dealing with details of a normal bank transaction. GitHub repository for this demo project : https://bit.ly/33KTJAu.

Sub-topics discussed :

  • Form design for insert and update operation.
  • Display forms in modal popup dialog.
  • Form post using jQuery Ajax.
  • Implement MVC CRUD operations with jQuery Ajax.
  • Loading spinner in .NET Core MVC.
  • Prevent direct access to MVC action method.

Create ASP.NET Core MVC Project

In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N).

From new project window, Select Asp.Net Core Web Application_._

Image showing how to create ASP.NET Core Web API project in Visual Studio.

Once you provide the project name and location. Select Web Application(Model-View-Controller) and uncheck HTTPS Configuration. Above steps will create a brand new ASP.NET Core MVC project.

Showing project template selection for .NET Core MVC.

Setup a Database

Let’s create a database for this application using Entity Framework Core. For that we’ve to install corresponding NuGet Packages. Right click on project from solution explorer, select Manage NuGet Packages_,_ From browse tab, install following 3 packages.

Showing list of NuGet Packages for Entity Framework Core

Now let’s define DB model class file – /Models/TransactionModel.cs.

public class TransactionModel
{
    [Key]
    public int TransactionId { get; set; }

    [Column(TypeName ="nvarchar(12)")]
    [DisplayName("Account Number")]
    [Required(ErrorMessage ="This Field is required.")]
    [MaxLength(12,ErrorMessage ="Maximum 12 characters only")]
    public string AccountNumber { get; set; }

    [Column(TypeName ="nvarchar(100)")]
    [DisplayName("Beneficiary Name")]
    [Required(ErrorMessage = "This Field is required.")]
    public string BeneficiaryName { get; set; }

    [Column(TypeName ="nvarchar(100)")]
    [DisplayName("Bank Name")]
    [Required(ErrorMessage = "This Field is required.")]
    public string BankName { get; set; }

    [Column(TypeName ="nvarchar(11)")]
    [DisplayName("SWIFT Code")]
    [Required(ErrorMessage = "This Field is required.")]
    [MaxLength(11)]
    public string SWIFTCode { get; set; }

    [DisplayName("Amount")]
    [Required(ErrorMessage = "This Field is required.")]
    public int Amount { get; set; }

    [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
    public DateTime Date { get; set; }
}

C#Copy

Here we’ve defined model properties for the transaction with proper validation. Now let’s define  DbContextclass for EF Core.

#asp.net core article #asp.net core #add loading spinner in asp.net core #asp.net core crud without reloading #asp.net core jquery ajax form #asp.net core modal dialog #asp.net core mvc crud using jquery ajax #asp.net core mvc with jquery and ajax #asp.net core popup window #bootstrap modal popup in asp.net core mvc. bootstrap modal popup in asp.net core #delete and viewall in asp.net core #jquery ajax - insert #jquery ajax form post #modal popup dialog in asp.net core #no direct access action method #update #validation in modal popup

Index is not an attribute class – Error while migrating from ASP.Net MVC 5 to .Net Core

Recently one of my friends was migrating a project from ASP.Net MVC 5 to ASP.Net core 3.1. One of the challenges he faced is with the Index Attribute in data annotations. The .Net Core is not recognizing the Index attribute. When he copied his class from his MVC 5 project, he got the following error message.

clip_image001

Though the other data annotations accepted by .Net Core, this data attribute “Index” was throwing an exception.

“Index is not an attribute class”

Cool!. Let us dig into the details. You can find the related post on the Entity Framework Github page.

https://github.com/dotnet/efcore/issues/1698

https://github.com/dotnet/efcore/issues/4050

From the page, it is clear now, this is not a bug, the EF Core team didn’t migrate the Index Attribute from the EF 6. So we need to live with this.

Now the question arises, how we are going to add the Indexes to our Tables. The answer is to use the Fluent API in ASP.Net core.

You can refer to the following link on the Microsoft Site to get the details of how to apply the Index to a property.

https://docs.microsoft.com/en-us/ef/core/modeling/indexes

So the solution is to replace the Index Attribute to the Fluent API, as below.

clip_image002

In real life, you will have many classes, and adding all classes using Fluent API inside OnModelCreating() method will make your code difficult to maintain. The solution is to create a separate class derived from IEntityTypeConfiguration. This will help us define all the related configurations in a single class and then apply the configurations from the OnModelCreating() method.

Let us apply the configuration class for the above. The following is the configuration class.

clip_image003

Once you have the configuration class, you can apply the configuration in the ModelCreating() method as follows.

clip_image004

Happy Coding!

#asp.net #asp.net core 3.1 #.net core #entity framework core #mvc #migration #.net #microsoft

Adaline  Kulas

Adaline Kulas

1594166040

What are the benefits of cloud migration? Reasons you should migrate

The moving of applications, databases and other business elements from the local server to the cloud server called cloud migration. This article will deal with migration techniques, requirement and the benefits of cloud migration.

In simple terms, moving from local to the public cloud server is called cloud migration. Gartner says 17.5% revenue growth as promised in cloud migration and also has a forecast for 2022 as shown in the following image.

#cloud computing services #cloud migration #all #cloud #cloud migration strategy #enterprise cloud migration strategy #business benefits of cloud migration #key benefits of cloud migration #benefits of cloud migration #types of cloud migration

Eric  Bukenya

Eric Bukenya

1618666860

.NET Conf 2020 Demos & Sessions for .NET 5 + Virtual Events!

This year’s .NET Conf was the largest one yet, with over 80 live sessions across three days that were co-organized and presented by the .NET community and Microsoft. On top of all of that, it also marked the release of .NET 5.0  that brings a full set of new capabilities, performance gains, and new languages features for developers to create amazing apps. If you missed this year’s .NET Conf live stream, don’t worry because we have you covered!

#.net #.net core #asp.net #c# #.net conf #.net foundation #community #demos

Rubalema  Sonia

Rubalema Sonia

1625201400

Snacks Ordering System with ASP.NET 5 Razor Pages (Database Migration) - Part 4

Previous (Part 3): https://youtu.be/_qO1mEOhZ8w
Next (Part 5): https://youtu.be/-i-GrNNo1bo
This is part 4 of a Razor Pages series of tutorials for an online snacks/desserts ordering system.
In this part, database migration is done to the Visual Studio Code project. This creates the database through EF Core using SQLite. The seeding of the database Product table is done in code.

This step-by-step Razor Pages tutorial series demonstrates how to create a Razor Pages application from scratch, and how to add common functionality to it including communicating with a database, working with forms, and sending an email.

Like || Share || Spread || Love

Make sure you subscribe to our YouTube Channel and never miss our latest video:- http://bit.ly/Kaushik-roy-chowdhury-subscribe

Completed Project Source: https://github.com/krchome/Snacks

Buy me a coffee
https://www.buymeacoffee.com/5m1piIG

Support The Channel By Donations:
https://www.patreon.com/deveducator

For more updates Follow us on:-

Visit- https://kaushikroychowdhury.com

Facebook- https://www.facebook.com/deveducate

Twitter- https://twitter.com/krchome58

Linkedin- https://www.linkedin.com/in/chowdhurykaushik

Github- https://github.com/krchome

Blogger- https://krchome1.blogspot.com/

Live Journal- https://ext-5537239.livejournal.com/

MIx - https://mix.com/kaushikroychowdhury

#asp.net 5 #.net #net 5 #razor pages