Shubham Ankit

Shubham Ankit


System.Data in .NET Core 3.0

While it doesn’t get a lot of attention, System.Data is crucial for any sort of relational database access in .NET. Also known as ADO.NET in honor of its predecessor, ActiveX Data Objects, System.Data provides a generic framework upon which .NET database drivers can be built. This framework provides for certain conventions database drivers are expected to adhere to.

Connections, commands, and data readers are all based on a dual inheritance scheme. Each inherits some basic functionality from DbConnection, DbCommand, and DbDataReader respectively. They also implement the abstract interfaces IDbConnection, IDbCommand, and IDbDataReader, which allows for mocking scenarios and non-traditional data sources. This dual inheritance scheme is also used for all of the base classes described below.

While connection strings are normally thought of as strings, facilities exist for representing them as objects that inherit from DbConnectionStringBuilder. This handles database specific parsing of connection strings and gives the developer a better idea of what settings are available for a particular database.

System.Data predates ORMs for .NET, but it does offer a generic way to generate SQL via implementations of the DbDataAdapter and DbCommandBuilder classes. This was used both directly and in conjunction with normal and typed DataSets.

If you are looking for a real-world example of the abstract factory pattern, look at the DbProviderFactory. Subclasses of this provide connections, commands, command parameters, command builders, and data adapters. Essentially everything you need for data access without the need for database specific logic.

The Problem with Interfaces

As mentioned above, System.Data relies on dual inheritance. This can be a problem when adding new methods. For example, asynchronous operations were added to DbCommand in .NET 4.5. However, they could not be added to the matching IDbCommand interface because that would be a breaking change. Which in turn means you cannot use both asynchronous operations and the easily mocked abstract interface at the same time.

Microsoft could have done a one-time reset of the abstract interfaces in .NET Core 1.0 so they match the abstract classes. (Java has done this in the past with JDBC interfaces.) However, that would make sharing code with .NET Framework difficult.

If default interface methods make it into C# 8, then in theory they could be used to realign the interfaces in a backwards compatible manner. But again, that wouldn’t be compatible with .NET Framework since default interface methods is a .NET Core only feature. Nor would it work with older compilers and other .NET languages.

String Overloads for DbDataReader.Get*() #31595

Our first .NET Core 3.0 feature is the ability to pass a column name to the DbDataReader.GetXXX methods. A long-time complaint about this interface is you cannot refence columns by name. Which means instead you need to use this pattern:


An obvious (and to some, long overdue) simplification is to offer a string overload.


This has already been done in Oracle's Connector/NET and MySqlConnector.

For performance reasons this new method will not be marked as virtual, allowing the JIT compiler to easily inline it. And for the reasons mentioned above, the new set of methods will not be added to IDbDataReader.

XmlDataDocument #33442

If you know the history of XmlDataDocument, this may seem like an odd pick. It has been marked as obsolete with the warning 'XmlDataDocument class will be removed in a future release.' since .NET 4.0 was released in 2010.

The reason it is being picked up now is some WinForms and WPF applications use it. The bug report says, “This has 1-7% of usage in various categories from Apiport.”


One feature that won’t be made available in .NET Core 3 is DataTableExtensionsclass. While it appears to be fairly simple with only 6 extension methods, the AsDataView cannot be built without modifications to System.Data itself. The reasoning is fairly complex, having to do with internal methods, type forwarding, and the challenges posed by .NET Standard.

If you are interested, the relevant conversations are Port DatasetExtensions to .NET Core #19771Port DataTable.AsDataView extension methods #27610, and Exposing internal virtuals involving searching a key in DataView #31764.

What is GEEK

Buddha Community

Einar  Hintz

Einar Hintz


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 :

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
    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.")]
    public string SWIFTCode { get; set; }

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

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


Here we’ve defined model properties for the transaction with proper validation. Now let’s define  DbContextclass for EF Core. core article core #add loading spinner in core core crud without reloading core jquery ajax form core modal dialog core mvc crud using jquery ajax core mvc with jquery and ajax core popup window #bootstrap modal popup in core mvc. bootstrap modal popup in core #delete and viewall in core #jquery ajax - insert #jquery ajax form post #modal popup dialog in core #no direct access action method #update #validation in modal popup

Einar  Hintz

Einar Hintz


MVC User Registration & Login with ASP.NET Core Identity

User registration and authentication are mandatory in any application when you have little concern about privacy. Hence all most all application development starts with an authentication module. In this article, we will discuss the quickest way to use **ASP.NET Core Identity for User Login and Registration **in a new or existing MVC application.

Sub-topics discussed :

  • How to add ASP.NET Core Identity to MVC application.
  • Customize ASP.NET Core Identity.
  • Identity.UI Design Customization.
  • Next step.


ASP.NET Core Identity is an API, which provides both user interface(UI) and functions for user authentication, registration, authorization, etc. Modules/ APIs like this will really be helpful and fasten the development process. It comes with ASP.NET Core Framework and used in many applications before. Which makes the API more dependable and trustworthy.

ASP.NET Core MVC with user authentication can easily be accomplished using Identity.UI. While creating the MVC project, you just need to select Authentication as Individual User Accounts.

Showing how to create an MVC application with ASP.NET Core Identity API

The rest will be handled by ASP.NET Core Identity UI. It already contains razor view pages and backend codes for an authentication system. But that’s not what we want in most of the cases. we want to customize ASP.NET Core Identity as per our requirement. That’s what we do here.

Create an ASP.NET Core MVC Project

First of all, I will create a brand new ASP.NET Core MVC application without any authentication selected. We could add ASP.NET Core Identity later into the project.

In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N). From new project window, select ASP.NET Core Web Application.

Create an ASP.NET Core Web application

Once you provide the project name and location. A new window will be opened as follows, Select _Web Application(Model-View-Controller), _uncheck _HTTPS Configuration _and DO NOT select any authentication method. Above steps will create a brand new ASP.NET Core MVC project.

Select Model View Controller templet under .NET Core core article core #add core identity to existing project core identity in mvc core mvc login and registration #login and logout in core

Siphiwe  Nair

Siphiwe Nair


Your Data Architecture: Simple Best Practices for Your Data Strategy

If you accumulate data on which you base your decision-making as an organization, you should probably think about your data architecture and possible best practices.

If you accumulate data on which you base your decision-making as an organization, you most probably need to think about your data architecture and consider possible best practices. Gaining a competitive edge, remaining customer-centric to the greatest extent possible, and streamlining processes to get on-the-button outcomes can all be traced back to an organization’s capacity to build a future-ready data architecture.

In what follows, we offer a short overview of the overarching capabilities of data architecture. These include user-centricity, elasticity, robustness, and the capacity to ensure the seamless flow of data at all times. Added to these are automation enablement, plus security and data governance considerations. These points from our checklist for what we perceive to be an anticipatory analytics ecosystem.

#big data #data science #big data analytics #data analysis #data architecture #data transformation #data platform #data strategy #cloud data platform #data acquisition

gRPC & ASP.NET Core 3.1: How to create a gRPC service ?

You’ll need to open Visual Studio 2019 and select “gRPC service” in “Create a new project” screen:

gRPC & ASP.NET Core 3.1: How to create a gRPC service ? – Anthony Giretti’s .NET blog core core 3 core 3 #envoy #grpc

Shayne  Bayer

Shayne Bayer


How to use endpoint routing in ASP.NET Core 3.0 MVC

Learn how to implement endpoint routing in ASP.NET Core 3.0 MVC to bring more flexibility and functionality to your applications core 3.0 mvc core #programming