Contents tagged with .NET Standard
-
Functional Programming and LINQ via C#
-
Port Microsoft Concurrency Visualizer SDK to .NET Standard and NuGet
I uploaded a NuGet package of Microsoft Concurrency Visualizer SDK: ConcurrencyVisualizer. Microsoft Concurrency Visualizer is an extension tool for Visual Studio. It is a great tool for performance profiling and multithreading execution visualization. It also has
a SDK library to be invoked by code and draw markers and spans in the timeline. I used it to visualize sequential LINQ and Parallel LINQ (PLINQ) execution in my Functional Programming and LINQ tutorials. For example, array.Where(…).Select(…) sequential LINQ query and array.AsParallel().Where(…).Select(…) Parallel LINQ query can be visualized as following spans: -
TransientFaultHandling.Core: Retry library for .NET Core/.NET Standard
TransientFaultHandling.Core is retry library for transient error handling. It is ported from Microsoft Enterprise Library’s TransientFaultHandling library, a library widely used with .NET Framework. The retry pattern APIs are ported to .NET Core/.NET Standard, with outdated configuration API updated, and new retry APIs added for convenience.
-
Functional Programming and LINQ via C#
-
C# 10 new feature CallerArgumentExpression, argument check and more
The CallerArgumentExpression has been discussed for years, it was supposed to a part of C# 8.0 but got delayed. Finally this month it is delivered along with C# 10 and .NET 6.
-
Entity Framework/Core and LINQ to Entities (9) Performance
The previous parts has discussed some aspects that can impact the performance of EF/Core and LINQ to Entities, and here is a summary:
-
Entity Framework/Core and LINQ to Entities (8) Optimistic Concurrency
Conflicts can occur if the same data is read and changed concurrently. Generally, there are 2 concurrency control approaches:
-
Entity Framework/Core and LINQ to Entities (7) Data Changes and Transactions
Besides LINQ to Entities queries, EF/Core also provides rich APIs for data changes, with imperative paradigm.
-
Entity Framework/Core and LINQ to Entities (6) Query Data Loading
After translated to SQL, in LINQ to Entities, sequence queries returning IQueryable<T> implements deferred execution too.
-
Entity Framework/Core and LINQ to Entities (5) Query Translation Implementation
The previous part demonstrated what are the SQL translations of the LINQ to Entities queries. This part discusses how the translation is implemented. Regarding different database systems can have different query languages or different query APIs, EF/Core implement a provider model to work with different kinds of databases. In EF Core, the base libraries are the Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Relational NuGet packages. Microsoft.EntityFrameworkCore provides the database provider contracts as Microsoft.EntityFrameworkCore.Storage.IDatabaseProviderServices interface. And the SQL database support is implemented by the Microsoft.EntityFrameworkCore,SqlServer NuGet package, which provides Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseProviderServices type to implement IDatabaseProviderServices. There are other libraries for different databases, like Microsoft.EntityFrameworkCore.SQLite NuGet package for SQLite, etc.
-
Entity Framework/Core and LINQ to Entities (4) Query Methods (Operators)
This part discusses how to query SQL database with the defined mapping entities. In EF/Core, LINQ to Entities supports most of the methods provided by Queryable:
-
Entity Framework/Core and LINQ to Entities (3) Logging and Tracing Queries
EF version of this i
-
Entity Framework/Core and LINQ to Entities (2) Modeling Database: Object-Relational Mapping
.NET and SQL database and have 2 different data type systems. For example, .NET has System.Int64 and System.String, while SQL database has bigint and nvarchar; .NET has sequences and objects, while SQL database has tables and rows;, etc. Object-relational mapping is a popular technology to map and convert between application data objects and database relational data. In LINQ to Entities, the queries are based on Object-relational mapping.
-
Entity Framework/Core and LINQ to Entities (1) Remote Query
The previous chapters discussed LINQ to Objects, LINQ to XML (objects), and Parallel LINQ (to Objects). All of these LINQ technologies query local in-memory objects managed by .NET. This chapter discusses a different kind of LINQ technology, LINQ to Entities, which queries relational data managed by databases. LINQ to Entities was provided by Entity Framework (EF), a Microsoft library released since .NET Framework 3.5 Service Pack 1. In 2016, Microsoft also released the cross platform version, Entity Framework Core (EF Core), along with with .NET Core 1.0. EF and EF Core both implement a provider model, so that LINQ to Entitiescan be implemented by different providers to work with different kinds of databases, including SQL Server (on-premise database) and Azure SQL Database (cloud database, aka SQL Azure), DB2, MySQL, Oracle, PostgreSQL, SQLLite, etc.
-
Category Theory via C# (23) Performance
In functional programming, there are many powerful tools and patterns, like lambda expression, purity, deferred execution, immutability, fluent LINQ query composition, … But everything has a cost. As Alan Perlis said:
-
Category Theory via C# (22) More Monad: Continuation Monad
In C#, callback is frequently used. For example, a very simple Add function, without asynchrony:
-
Category Theory via C# (21) More Monad: Writer< , > Monad
Unlike the Reader< , > monad, the Writer< , > monad output contents with a sequence of functions:
-
Category Theory via C# (20) More Monad: Reader< , > Monad
Sometimes there are functions work with a shared environment. Typical examples are:
-
Category Theory via C# (19) More Monad: State< , > Monad
State machine (or finite state machine) represents a abstract machine with one state or a number of state. C# use state machine a lot. For example:
-
Category Theory via C# (18) More Monad: IO<> Monad
As mentioned in a previous part, in purely functional programming, functions cannot have side effects. For example, when defining LINQ queries, laziness and purity are expected. So, how should the impure actions be managed in purely functional programming or LINQ? For example: