SlideShare a Scribd company logo
What’s new in
.NET7
ecosystem
Tamir Dresher
@tamir_dresher
December 2022
Head of Architecture @
@tamir_dresher
Who am I?
Software Engineering Lecturer
Ruppin Academic Center
&
Payoneer at a glance
3
International
users
Locations and
counting
Countries
& territories
Growth in global cross-
border payments where
Payoneer has a local
presence
by thousands of leading
brands worldwide.
Agenda
4
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
Agenda
5
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
Static Abstract Members & Generic Math behind the scenes
• In C# 11 you can add static abstract members in interface which allows generic math
and other method that can depend on the operatorsmembers
public class AmazingMathClass
{
public static T MidPoint<T>(T x, T y) where T : INumber<T>
=> (x + y) / T.CreateChecked(2);
public static T Max<T>(T x, T y) where T : IComparisonOperators<T, T, bool>
=>
x < y ? x : y;
}
@tamir_dresher
Static Abstract Members & Generic Math behind the scenes
7
• In C# 11 you can add static abstract members in interface which allows generic math
• You can use this for advanced usages. For example, IParseable
// Summary: Defines a mechanism for parsing a string to a value.
// TSelf: The type that implements this interface.
public interface IParsable<TSelf> where TSelf : IParsable<TSelf>? {
static abstract TSelf Parse(string s, IFormatProvider? provider);
static abstract bool TryParse([NotNullWhen(true)] string? s,
IFormatProvider? provider, [MaybeNullWhen(false)] out TSelf result);
}
public static IEnumerable<T> ParseFile<T>(string path) where T : IParsable<T>
{
...
foreach (var line in lines)
{
yield return T.Parse(line, null);
}
}
8
Static Abstract Members & Generic Math behind the scenes
public class Person : I Parsable<Person>
{
public string Name { get; set; } = "";
public static Person Parse(string s, IFormatProvider? provider){ ... }
public static bool TryParse(...) { ... }
}
public class VeryImportantPerson : Person
{
public required int Rating { get; set; }
}
@tamir_dresher
9
Static Abstract Members & Generic Math behind the scenes
public class Person : I Parsable<Person>
{
public string Name { get; set; } = "";
public static Person Parse(string s, IFormatProvider? provider){ ... }
public static bool TryParse(...) { ... }
}
public class VeryImportantPerson : Person, IParsable<VeryImportantPerson>
{
public required int Rating { get; set; }
public static VeryImportantPerson Parse(string s, IFormatProvider? provider){ ... }
public static bool TryParse(...) { ... }
}
@tamir_dresher
Agenda
10
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
File Scoped Type
11
• Permit a file modifier on top-level type
declarations.
• The type only exists in the file where it
is declared.
• Same type name can exist in multiple files
• Generally useful for generated code and
encapsulating private implementation
– Note: you won’t be able to the test the
file scoped types directly
https://github.com/dotnet/csharplang/issues/6011
namespace FileScopedTypes
{
file interface IWidget
{
int ProvideAnswer();
}
file class HiddenWidget
{
public int Work() => 1337;
}
public class Widget : IWidget
{
public int ProvideAnswer()
{
var worker = new
HiddenWidget();
return worker.Work();
}
}
} @tamir_dresher
File Scoped Type – behind the scenes
12
• The compiler renames types with the file restriction
<SourceFileNameWithoutExtension>F$identfier$_TypeName. identfier
Agenda
13
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
Microseconds and Nanoseconds support
14
https://github.com/dotnet/runtime/issues/23799
Add Microseconds and Nanoseconds to TimeStamp, DateTime, DateTimeOffset, and TimeOnly · Issue #23799
DateTime.Parse("0001-01-01 00:00:00.0009990").Microsecond; // 999
DateTime.Parse("0001-01-01 00:00:00.0000009").Nanosecond; // 900
DateTimeOffset.Parse("0001-01-01 00:00:00.0009990 -7").Microsecond; //
999
DateTimeOffset.Parse("0001-01-01 00:00:00.0000009 -7").Nanosecond; //
900
new DateTimeOffset().AddMicroseconds(999).Ticks; // 9990
TimeSpan.Parse("00:00:00.0009990").Microseconds; // 999
TimeSpan.Parse("00:00:00.0000009").Nanoseconds; // 900
Agenda
15
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
StringSyntaxAttribute
16
• allows marking a string as containing a specific type of value which result in
– Syntax highlighting for the specific type
– Basic validation for the specific type such as:
– DateOnlyFormat
– DateTimeFormat
– EnumFormat
– GuidFormat
– Json
– NumericFormat
– Regex
– Uri
– Xml
@tamir_dresher
StringSyntaxAttribute.Json
17
• allows marking a string as containing a specific type of value which result in
– Syntax highlighting for the specific type
– Basic validation for the specific type.
class MeetupParser
{
public Meetup ParseJson([StringSyntax(StringSyntaxAttribute.Json)]string
json)
{
return null;
}
}
Agenda
18
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
LINQ - Order and OrderDescending
19
Before .NET 7
var data = new[] { 2, 1, 3 };
var sorted = data.OrderBy(static e => e);
var sortedDesc = data.OrderByDescending(static e => e);
After .NET 7
var data = new[] { 2, 1, 3 };
var sorted = data.Order();
var sortedDesc = data.OrderDescending();
@tamir_dresher
Agenda
20
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
Rate limiting APIs
21
• Use Microsoft.AspNetCore.RateLimiting middleware to add rate limiting to your app
• You can define rate limiting policies and attach them to endpoints
• * currently state can’t be shared cross servers out of the box
0 1 2
- request
Tokens filled at
constant rate
Token emptied one
request at a time
1sec
req1
req2
req3
Fixed window Sliding window Token (Leaky) bucket Concurrency
limits the number of
concurrent requests
Window slides one
segment at a time
@tamir_dresher
Rate limiting APIs – policy config
builder.Services.AddRateLimiter(_ => _
.AddFixedWindowLimiter(policyName: "fixed", options =>
{
options.PermitLimit = 4;
options.Window = TimeSpan.FromSeconds(12);
options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst;
options.QueueLimit = 2;
}));
var app = builder.Build();
app.UseRateLimiter();
@tamir_dresher
Rate limiting APIs – endpoint rate-limit
app.MapGet("/", () => Results.Ok($"Hello"))
.RequireRateLimiting("fixed");
[EnableRateLimiting("fixed")]
[HttpGet("limited", Name = "GetWeatherForecastWithLimit")]
public IEnumerable<WeatherForecast> GetWithLimit()
{
...
}
[DisableRateLimiting]
public ActionResult NoLimit()
{
return Ok();
}
@tamir_dresher
Rate limiting APIs – rate-limit per user
builder.Services.AddRateLimiter(limiterOptions => {
limiterOptions.AddPolicy("userPolicy", context =>
{
var username = "anonymous user";
if (context.User.Identity?.IsAuthenticated is true)
{
username = context.User.ToString()!;
}
return RateLimitPartition.GetSlidingWindowLimiter(username,
_ => new SlidingWindowRateLimiterOptions
{
PermitLimit = 4,
QueueProcessingOrder = QueueProcessingOrder.OldestFirst,
QueueLimit = 2,
Window = TimeSpan.FromSeconds(10),
SegmentsPerWindow = 4 //each segment is 2.5 seconds
});
});
});
Rate limiting APIs – under the hood
25
• Introducing the new, in .NET 7, nuget package System.Threading.RateLimiting!
https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/
public abstract class RateLimiter : IAsyncDisposable, IDisposable
{
public abstract int GetAvailablePermits();
public abstract TimeSpan? IdleDuration { get; }
public RateLimitLease Acquire(int permitCount = 1);
public ValueTask<RateLimitLease> WaitAsync(int permitCount = 1, CancellationToken cancellationToken = default);
public void Dispose();
public ValueTask DisposeAsync();
}
RateLimiter limiter = GetLimiter();
using RateLimitLease lease = limiter.Acquire(permitCount: 1);
if (lease.IsAcquired)
{
// Do action that is protected by limiter
}
else
{
// Error handling or add retry logic
}
Rate limiting APIs – under the hood
26
• Introducing the new, in .NET 7, nuget package System.Threading.RateLimiting!
https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/
public abstract class RateLimiter : IAsyncDisposable, IDisposable
{
public abstract int GetAvailablePermits();
public abstract TimeSpan? IdleDuration { get; }
public RateLimitLease Acquire(int permitCount = 1);
public ValueTask<RateLimitLease> WaitAsync(int permitCount = 1, CancellationToken cancellationToken = default);
public void Dispose();
public ValueTask DisposeAsync();
}
RateLimiter limiter = GetLimiter();
using RateLimitLease lease = limiter.Acquire(permitCount: 1);
if (lease.IsAcquired)
{
// Do action that is protected by limiter
}
else
{
// Error handling or add retry logic
}
Agenda
27
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
Incremental migration from ASP.NET to ASP.NET
28
• The Microsoft.AspNetCore.SystemWebAdapters.* packages allows consuming
business logic libraries that depends on HttpContext and System.Web APIs
• Session, Cookies and Authentication can also be shared
@tamir_dresher
Incremental migration from ASP.NET to ASP.NET
29
https://marketplace.visualstudio.com/items?itemName=WebToolsTeam.aspnetprojectmigrations
Agenda
31
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
Central-Package-Management
32
• Control packages version in all projects under a specific folder
• Place Directory.Packages.props file in the root folder and set the packages version
• Add <PackageReference> without a version to the dependent projects
Directory.Packages.pr
ops
App1.csproj
@tamir_dresher
Agenda
33
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
EF Core 7 Json columns
34
• EF7 contains provider-agnostic support for JSON columns, with SQL Server
implementation.
• Allows mapping of aggregates built from .NET types to JSON documents.
• Normal LINQ queries can be used on the aggregates, and these will be translated to
the appropriate query constructs needed to drill into the JSON.
protected override void OnModelCreating(ModelBuilder mBuilder)
{
mBuilder.Entity<Author>().OwnsOne(
author => author.Contact, navigationBuilder =>
{
navigationBuilder.ToJson();
navigationBuilder.OwnsOne(contactDetails =>
contactDetails.Address);
});
}
public class Author
{
public int Id { get; set; }
public string Name { get; set; }
public ContactDetails Contact { get; set; }
}
public class ContactDetails
{
public Address Address { get; set; } = null!;
public string? Phone { get; set; }
}
public class Address
{
...
} @tamir_dresher
EF Core 7 Json columns
35
public class Author
{
public int Id { get; set; }
public string Name { get; set; }
public ContactDetails Contact { get; set; }
}
public class ContactDetails
{
public Address Address { get; set; } = null!;
public string? Phone { get; set; }
}
public class Address
{
...
}
Agenda
36
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
EF Core 7 bulk delete
37
Before EF Core 7
EF Core 7
var furniture = await context.Products.Where(p => p.CategoryId ==
3).ToListAsync();
foreach (var product in furniture)
{
context.Remove(product);
}
await context.SaveChangesAsync();
await context.Products.Where(p => p.CategoryId == 3).ExecuteDeleteAsync();
await context.Products
.Where(p => p.Category.Name.StartsWith("Furntiture"))
.ExecuteDeleteAsync();
Calling ExecuteDelete or ExecuteDeleteAsync on a DbSet immediately deletes from the database.
@tamir_dresher
EF Core 7 bulk update
38
await context.Products
.Where(p => p.CategoryId==3 && p.Price > 100)
.ExecuteUpdateAsync(s => s
.SetProperty(p => p.Name, p =>
p.Name.EndsWith(" *") ? p.Name.Replace(" *", "") : p.Name + " *")
.SetProperty(p => p.Price, p => p.Price - 12));
@tamir_dresher
Agenda
39
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher
EF Core 7 - New interceptors
40
 Interception for creating and populating new entity instances (aka "materialization")
 Interception to modify the LINQ expression tree before a query is compiled
 Interception for optimistic concurrency handling (DbUpdateConcurrencyException)
 Interception for connections before checking if the connection string has been set
 Interception for when EF has finished consuming a result set, but before that result set is closed
 Interception for creation of a DbConnection by EF Core
 Interception for DbCommand after it has been initialized
public class SetRetrievedInterceptor : IMaterializationInterceptor
{
public object InitializedInstance(MaterializationInterceptionData materializationData, object instance)
{
if (instance is IHasRetrieved hasRetrieved)
{
hasRetrieved.Retrieved = DateTime.UtcNow;
}
return instance;
}
}
public interface IHasRetrieved
{
DateTime Retrieved { get; set; }
}
Summary
41
• Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>)
• File scoped types
• Microseconds and nanoseconds in time related types
• StringSyntaxAttribute
• LINQ Brings Order and OrderDescending
• Rate limiting APIs to protect a resource by keeping traffic at a safe level
• Incremental migration from ASP.NET to ASP.NET
• NuGet - Central Package Management
• EF Core 7 Json columns
• EF Core 7 bulk update and delete
• EF Core 7 new interceptors
@tamir_dresher

More Related Content

PPTX
What's new in c# 8.0
Moaid Hathot
 
PDF
Whats new in .NET for 2019
Rory Preddy
 
PPTX
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Marco Parenzan
 
PPTX
Learn Mastering-the-NET-Interview 2.pptx
surajkumartpoint
 
PPTX
Mini .net conf 2020
Marco Parenzan
 
PPT
ASP.net web api Power Point Presentation
BefastMeetingMinutes
 
PPTX
What's New in .Net 4.5
Malam Team
 
PDF
767458168-Introduction-to-Web-API767458168-Introduction-to-Web-API.pdf.pdf
ssuser16fbed
 
What's new in c# 8.0
Moaid Hathot
 
Whats new in .NET for 2019
Rory Preddy
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Marco Parenzan
 
Learn Mastering-the-NET-Interview 2.pptx
surajkumartpoint
 
Mini .net conf 2020
Marco Parenzan
 
ASP.net web api Power Point Presentation
BefastMeetingMinutes
 
What's New in .Net 4.5
Malam Team
 
767458168-Introduction-to-Web-API767458168-Introduction-to-Web-API.pdf.pdf
ssuser16fbed
 

Similar to Tamir Dresher - DotNet 7 What's new.pptx (20)

PPTX
C#: Past, Present and Future
Rodolfo Finochietti
 
PDF
C# 8 in Libraries and Applications
Christian Nagel
 
PPTX
Next .NET and C#
Bertrand Le Roy
 
PPTX
Whats new in .net for 2019
Rory Preddy
 
DOCX
Prueba de conociemientos Fullsctack NET v2.docx
jairatuesta
 
PDF
C# 8 in Libraries and Applications - BASTA! Frankfurt 2020
Christian Nagel
 
PDF
.NET Core, ASP.NET Core Course, Session 16
Amin Mesbahi
 
PPTX
.NET Foundation, Future of .NET and C#
Bertrand Le Roy
 
PPTX
A Tour of EF Core's (1.1) Most Interesting & Important Features
Julie Lerman
 
PPTX
Игорь Фесенко "Direction of C# as a High-Performance Language"
Fwdays
 
PPTX
C sharp 8.0 new features
Miguel Bernard
 
PPTX
C sharp 8.0 new features
MSDEVMTL
 
PDF
C# 7.x What's new and what's coming with C# 8
Christian Nagel
 
PPTX
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
Karel Zikmund
 
PPTX
ASP.Net 5 and C# 6
Andy Butland
 
PDF
C# 10 in a Nutshell_ The Definitive Reference-O'Reilly Media (2022).pdf
ssuser2a88da1
 
PPTX
New C# features
Alexej Sommer
 
PPTX
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
Muralidharan Deenathayalan
 
PPTX
High Performance Coding2.pptx
ShymmaaQadoom1
 
PDF
C 7 0 in a Nutshell The Definitive Reference 7th Edition Joseph Albahari
becelaeeppo
 
C#: Past, Present and Future
Rodolfo Finochietti
 
C# 8 in Libraries and Applications
Christian Nagel
 
Next .NET and C#
Bertrand Le Roy
 
Whats new in .net for 2019
Rory Preddy
 
Prueba de conociemientos Fullsctack NET v2.docx
jairatuesta
 
C# 8 in Libraries and Applications - BASTA! Frankfurt 2020
Christian Nagel
 
.NET Core, ASP.NET Core Course, Session 16
Amin Mesbahi
 
.NET Foundation, Future of .NET and C#
Bertrand Le Roy
 
A Tour of EF Core's (1.1) Most Interesting & Important Features
Julie Lerman
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Fwdays
 
C sharp 8.0 new features
Miguel Bernard
 
C sharp 8.0 new features
MSDEVMTL
 
C# 7.x What's new and what's coming with C# 8
Christian Nagel
 
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
Karel Zikmund
 
ASP.Net 5 and C# 6
Andy Butland
 
C# 10 in a Nutshell_ The Definitive Reference-O'Reilly Media (2022).pdf
ssuser2a88da1
 
New C# features
Alexej Sommer
 
New features of Minimal APIs in .NET 7 -Muralidharan Deenathayalan.pptx
Muralidharan Deenathayalan
 
High Performance Coding2.pptx
ShymmaaQadoom1
 
C 7 0 in a Nutshell The Definitive Reference 7th Edition Joseph Albahari
becelaeeppo
 
Ad

More from Tamir Dresher (20)

PPTX
Engineering tools for making smarter decisions .pptx
Tamir Dresher
 
PDF
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
PPTX
Tamir Dresher - What’s new in ASP.NET Core 6
Tamir Dresher
 
PPTX
Tamir Dresher - Async Streams in C#
Tamir Dresher
 
PPTX
Anatomy of a data driven architecture - Tamir Dresher
Tamir Dresher
 
PPTX
Tamir Dresher Clarizen adventures with the wild GC during the holiday season
Tamir Dresher
 
PDF
Debugging tricks you wish you knew Tamir Dresher - Odessa 2019
Tamir Dresher
 
PDF
From zero to hero with the actor model - Tamir Dresher - Odessa 2019
Tamir Dresher
 
PPTX
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher
 
PPTX
Breaking the monolith to microservice with Docker and Kubernetes (k8s)
Tamir Dresher
 
PPTX
.Net december 2017 updates - Tamir Dresher
Tamir Dresher
 
PPTX
Testing time and concurrency Rx
Tamir Dresher
 
PPTX
Building responsive application with Rx - confoo - tamir dresher
Tamir Dresher
 
PPTX
.NET Debugging tricks you wish you knew tamir dresher
Tamir Dresher
 
PPTX
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
PPTX
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
PPTX
Debugging tricks you wish you knew - Tamir Dresher
Tamir Dresher
 
PPTX
Rx 101 - Tamir Dresher - Copenhagen .NET User Group
Tamir Dresher
 
PPTX
Cloud patterns - NDC Oslo 2016 - Tamir Dresher
Tamir Dresher
 
PPTX
Reactiveness All The Way - SW Architecture 2015 Conference
Tamir Dresher
 
Engineering tools for making smarter decisions .pptx
Tamir Dresher
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
Tamir Dresher - What’s new in ASP.NET Core 6
Tamir Dresher
 
Tamir Dresher - Async Streams in C#
Tamir Dresher
 
Anatomy of a data driven architecture - Tamir Dresher
Tamir Dresher
 
Tamir Dresher Clarizen adventures with the wild GC during the holiday season
Tamir Dresher
 
Debugging tricks you wish you knew Tamir Dresher - Odessa 2019
Tamir Dresher
 
From zero to hero with the actor model - Tamir Dresher - Odessa 2019
Tamir Dresher
 
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher
 
Breaking the monolith to microservice with Docker and Kubernetes (k8s)
Tamir Dresher
 
.Net december 2017 updates - Tamir Dresher
Tamir Dresher
 
Testing time and concurrency Rx
Tamir Dresher
 
Building responsive application with Rx - confoo - tamir dresher
Tamir Dresher
 
.NET Debugging tricks you wish you knew tamir dresher
Tamir Dresher
 
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
Debugging tricks you wish you knew - Tamir Dresher
Tamir Dresher
 
Rx 101 - Tamir Dresher - Copenhagen .NET User Group
Tamir Dresher
 
Cloud patterns - NDC Oslo 2016 - Tamir Dresher
Tamir Dresher
 
Reactiveness All The Way - SW Architecture 2015 Conference
Tamir Dresher
 
Ad

Recently uploaded (20)

PDF
Become an Agentblazer Champion Challenge
Dele Amefo
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
Become an Agentblazer Champion Challenge
Dele Amefo
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 

Tamir Dresher - DotNet 7 What's new.pptx

  • 1. What’s new in .NET7 ecosystem Tamir Dresher @tamir_dresher December 2022
  • 2. Head of Architecture @ @tamir_dresher Who am I? Software Engineering Lecturer Ruppin Academic Center &
  • 3. Payoneer at a glance 3 International users Locations and counting Countries & territories Growth in global cross- border payments where Payoneer has a local presence by thousands of leading brands worldwide.
  • 4. Agenda 4 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 5. Agenda 5 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 6. Static Abstract Members & Generic Math behind the scenes • In C# 11 you can add static abstract members in interface which allows generic math and other method that can depend on the operatorsmembers public class AmazingMathClass { public static T MidPoint<T>(T x, T y) where T : INumber<T> => (x + y) / T.CreateChecked(2); public static T Max<T>(T x, T y) where T : IComparisonOperators<T, T, bool> => x < y ? x : y; } @tamir_dresher
  • 7. Static Abstract Members & Generic Math behind the scenes 7 • In C# 11 you can add static abstract members in interface which allows generic math • You can use this for advanced usages. For example, IParseable // Summary: Defines a mechanism for parsing a string to a value. // TSelf: The type that implements this interface. public interface IParsable<TSelf> where TSelf : IParsable<TSelf>? { static abstract TSelf Parse(string s, IFormatProvider? provider); static abstract bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out TSelf result); } public static IEnumerable<T> ParseFile<T>(string path) where T : IParsable<T> { ... foreach (var line in lines) { yield return T.Parse(line, null); } }
  • 8. 8 Static Abstract Members & Generic Math behind the scenes public class Person : I Parsable<Person> { public string Name { get; set; } = ""; public static Person Parse(string s, IFormatProvider? provider){ ... } public static bool TryParse(...) { ... } } public class VeryImportantPerson : Person { public required int Rating { get; set; } } @tamir_dresher
  • 9. 9 Static Abstract Members & Generic Math behind the scenes public class Person : I Parsable<Person> { public string Name { get; set; } = ""; public static Person Parse(string s, IFormatProvider? provider){ ... } public static bool TryParse(...) { ... } } public class VeryImportantPerson : Person, IParsable<VeryImportantPerson> { public required int Rating { get; set; } public static VeryImportantPerson Parse(string s, IFormatProvider? provider){ ... } public static bool TryParse(...) { ... } } @tamir_dresher
  • 10. Agenda 10 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 11. File Scoped Type 11 • Permit a file modifier on top-level type declarations. • The type only exists in the file where it is declared. • Same type name can exist in multiple files • Generally useful for generated code and encapsulating private implementation – Note: you won’t be able to the test the file scoped types directly https://github.com/dotnet/csharplang/issues/6011 namespace FileScopedTypes { file interface IWidget { int ProvideAnswer(); } file class HiddenWidget { public int Work() => 1337; } public class Widget : IWidget { public int ProvideAnswer() { var worker = new HiddenWidget(); return worker.Work(); } } } @tamir_dresher
  • 12. File Scoped Type – behind the scenes 12 • The compiler renames types with the file restriction <SourceFileNameWithoutExtension>F$identfier$_TypeName. identfier
  • 13. Agenda 13 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 14. Microseconds and Nanoseconds support 14 https://github.com/dotnet/runtime/issues/23799 Add Microseconds and Nanoseconds to TimeStamp, DateTime, DateTimeOffset, and TimeOnly · Issue #23799 DateTime.Parse("0001-01-01 00:00:00.0009990").Microsecond; // 999 DateTime.Parse("0001-01-01 00:00:00.0000009").Nanosecond; // 900 DateTimeOffset.Parse("0001-01-01 00:00:00.0009990 -7").Microsecond; // 999 DateTimeOffset.Parse("0001-01-01 00:00:00.0000009 -7").Nanosecond; // 900 new DateTimeOffset().AddMicroseconds(999).Ticks; // 9990 TimeSpan.Parse("00:00:00.0009990").Microseconds; // 999 TimeSpan.Parse("00:00:00.0000009").Nanoseconds; // 900
  • 15. Agenda 15 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 16. StringSyntaxAttribute 16 • allows marking a string as containing a specific type of value which result in – Syntax highlighting for the specific type – Basic validation for the specific type such as: – DateOnlyFormat – DateTimeFormat – EnumFormat – GuidFormat – Json – NumericFormat – Regex – Uri – Xml @tamir_dresher
  • 17. StringSyntaxAttribute.Json 17 • allows marking a string as containing a specific type of value which result in – Syntax highlighting for the specific type – Basic validation for the specific type. class MeetupParser { public Meetup ParseJson([StringSyntax(StringSyntaxAttribute.Json)]string json) { return null; } }
  • 18. Agenda 18 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 19. LINQ - Order and OrderDescending 19 Before .NET 7 var data = new[] { 2, 1, 3 }; var sorted = data.OrderBy(static e => e); var sortedDesc = data.OrderByDescending(static e => e); After .NET 7 var data = new[] { 2, 1, 3 }; var sorted = data.Order(); var sortedDesc = data.OrderDescending(); @tamir_dresher
  • 20. Agenda 20 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 21. Rate limiting APIs 21 • Use Microsoft.AspNetCore.RateLimiting middleware to add rate limiting to your app • You can define rate limiting policies and attach them to endpoints • * currently state can’t be shared cross servers out of the box 0 1 2 - request Tokens filled at constant rate Token emptied one request at a time 1sec req1 req2 req3 Fixed window Sliding window Token (Leaky) bucket Concurrency limits the number of concurrent requests Window slides one segment at a time @tamir_dresher
  • 22. Rate limiting APIs – policy config builder.Services.AddRateLimiter(_ => _ .AddFixedWindowLimiter(policyName: "fixed", options => { options.PermitLimit = 4; options.Window = TimeSpan.FromSeconds(12); options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst; options.QueueLimit = 2; })); var app = builder.Build(); app.UseRateLimiter(); @tamir_dresher
  • 23. Rate limiting APIs – endpoint rate-limit app.MapGet("/", () => Results.Ok($"Hello")) .RequireRateLimiting("fixed"); [EnableRateLimiting("fixed")] [HttpGet("limited", Name = "GetWeatherForecastWithLimit")] public IEnumerable<WeatherForecast> GetWithLimit() { ... } [DisableRateLimiting] public ActionResult NoLimit() { return Ok(); } @tamir_dresher
  • 24. Rate limiting APIs – rate-limit per user builder.Services.AddRateLimiter(limiterOptions => { limiterOptions.AddPolicy("userPolicy", context => { var username = "anonymous user"; if (context.User.Identity?.IsAuthenticated is true) { username = context.User.ToString()!; } return RateLimitPartition.GetSlidingWindowLimiter(username, _ => new SlidingWindowRateLimiterOptions { PermitLimit = 4, QueueProcessingOrder = QueueProcessingOrder.OldestFirst, QueueLimit = 2, Window = TimeSpan.FromSeconds(10), SegmentsPerWindow = 4 //each segment is 2.5 seconds }); }); });
  • 25. Rate limiting APIs – under the hood 25 • Introducing the new, in .NET 7, nuget package System.Threading.RateLimiting! https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/ public abstract class RateLimiter : IAsyncDisposable, IDisposable { public abstract int GetAvailablePermits(); public abstract TimeSpan? IdleDuration { get; } public RateLimitLease Acquire(int permitCount = 1); public ValueTask<RateLimitLease> WaitAsync(int permitCount = 1, CancellationToken cancellationToken = default); public void Dispose(); public ValueTask DisposeAsync(); } RateLimiter limiter = GetLimiter(); using RateLimitLease lease = limiter.Acquire(permitCount: 1); if (lease.IsAcquired) { // Do action that is protected by limiter } else { // Error handling or add retry logic }
  • 26. Rate limiting APIs – under the hood 26 • Introducing the new, in .NET 7, nuget package System.Threading.RateLimiting! https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/ public abstract class RateLimiter : IAsyncDisposable, IDisposable { public abstract int GetAvailablePermits(); public abstract TimeSpan? IdleDuration { get; } public RateLimitLease Acquire(int permitCount = 1); public ValueTask<RateLimitLease> WaitAsync(int permitCount = 1, CancellationToken cancellationToken = default); public void Dispose(); public ValueTask DisposeAsync(); } RateLimiter limiter = GetLimiter(); using RateLimitLease lease = limiter.Acquire(permitCount: 1); if (lease.IsAcquired) { // Do action that is protected by limiter } else { // Error handling or add retry logic }
  • 27. Agenda 27 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 28. Incremental migration from ASP.NET to ASP.NET 28 • The Microsoft.AspNetCore.SystemWebAdapters.* packages allows consuming business logic libraries that depends on HttpContext and System.Web APIs • Session, Cookies and Authentication can also be shared @tamir_dresher
  • 29. Incremental migration from ASP.NET to ASP.NET 29 https://marketplace.visualstudio.com/items?itemName=WebToolsTeam.aspnetprojectmigrations
  • 30. Agenda 31 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 31. Central-Package-Management 32 • Control packages version in all projects under a specific folder • Place Directory.Packages.props file in the root folder and set the packages version • Add <PackageReference> without a version to the dependent projects Directory.Packages.pr ops App1.csproj @tamir_dresher
  • 32. Agenda 33 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 33. EF Core 7 Json columns 34 • EF7 contains provider-agnostic support for JSON columns, with SQL Server implementation. • Allows mapping of aggregates built from .NET types to JSON documents. • Normal LINQ queries can be used on the aggregates, and these will be translated to the appropriate query constructs needed to drill into the JSON. protected override void OnModelCreating(ModelBuilder mBuilder) { mBuilder.Entity<Author>().OwnsOne( author => author.Contact, navigationBuilder => { navigationBuilder.ToJson(); navigationBuilder.OwnsOne(contactDetails => contactDetails.Address); }); } public class Author { public int Id { get; set; } public string Name { get; set; } public ContactDetails Contact { get; set; } } public class ContactDetails { public Address Address { get; set; } = null!; public string? Phone { get; set; } } public class Address { ... } @tamir_dresher
  • 34. EF Core 7 Json columns 35 public class Author { public int Id { get; set; } public string Name { get; set; } public ContactDetails Contact { get; set; } } public class ContactDetails { public Address Address { get; set; } = null!; public string? Phone { get; set; } } public class Address { ... }
  • 35. Agenda 36 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 36. EF Core 7 bulk delete 37 Before EF Core 7 EF Core 7 var furniture = await context.Products.Where(p => p.CategoryId == 3).ToListAsync(); foreach (var product in furniture) { context.Remove(product); } await context.SaveChangesAsync(); await context.Products.Where(p => p.CategoryId == 3).ExecuteDeleteAsync(); await context.Products .Where(p => p.Category.Name.StartsWith("Furntiture")) .ExecuteDeleteAsync(); Calling ExecuteDelete or ExecuteDeleteAsync on a DbSet immediately deletes from the database. @tamir_dresher
  • 37. EF Core 7 bulk update 38 await context.Products .Where(p => p.CategoryId==3 && p.Price > 100) .ExecuteUpdateAsync(s => s .SetProperty(p => p.Name, p => p.Name.EndsWith(" *") ? p.Name.Replace(" *", "") : p.Name + " *") .SetProperty(p => p.Price, p => p.Price - 12)); @tamir_dresher
  • 38. Agenda 39 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher
  • 39. EF Core 7 - New interceptors 40  Interception for creating and populating new entity instances (aka "materialization")  Interception to modify the LINQ expression tree before a query is compiled  Interception for optimistic concurrency handling (DbUpdateConcurrencyException)  Interception for connections before checking if the connection string has been set  Interception for when EF has finished consuming a result set, but before that result set is closed  Interception for creation of a DbConnection by EF Core  Interception for DbCommand after it has been initialized public class SetRetrievedInterceptor : IMaterializationInterceptor { public object InitializedInstance(MaterializationInterceptionData materializationData, object instance) { if (instance is IHasRetrieved hasRetrieved) { hasRetrieved.Retrieved = DateTime.UtcNow; } return instance; } } public interface IHasRetrieved { DateTime Retrieved { get; set; } }
  • 40. Summary 41 • Static Abstract Members and Generic Math behind the scenes(+ IParsable<TSelf>) • File scoped types • Microseconds and nanoseconds in time related types • StringSyntaxAttribute • LINQ Brings Order and OrderDescending • Rate limiting APIs to protect a resource by keeping traffic at a safe level • Incremental migration from ASP.NET to ASP.NET • NuGet - Central Package Management • EF Core 7 Json columns • EF Core 7 bulk update and delete • EF Core 7 new interceptors @tamir_dresher

Editor's Notes

  • #5: C# 11 static abstract members – Ndepend
  • #6: C# 11 static abstract members – Ndepend
  • #7: where T : class? The type argument must be a reference type, either nullable or non-nullable. This constraint applies also to any class, interface, delegate, or array type. The Curiously Recurring Template Pattern (CRTP) Static Abstract Members In C# 10 Interfaces | Khalid Abuhakmeh
  • #8: where T : class? The type argument must be a reference type, either nullable or non-nullable. This constraint applies also to any class, interface, delegate, or array type. The Curiously Recurring Template Pattern (CRTP) Static Abstract Members In C# 10 Interfaces | Khalid Abuhakmeh
  • #11: C# 11 static abstract members – Ndepend
  • #13: C# 11 File Scoped Types - NDepend
  • #14: C# 11 static abstract members – Ndepend
  • #16: C# 11 static abstract members – Ndepend
  • #19: C# 11 static abstract members – Ndepend
  • #21: C# 11 static abstract members – Ndepend
  • #22: The concurrency limiter limits the number concurrent requests. Each request reduces the concurrency limit by one. When a request completes, the limit is increased by one. Unlike the other requests limiters that limit the total number of requests for a specified period, the concurrency limiter limits only the number of concurrent requests and doesn't cap the number of requests in a time period.
  • #23: The concurrency limiter limits the number concurrent requests. Each request reduces the concurrency limit by one. When a request completes, the limit is increased by one. Unlike the other requests limiters that limit the total number of requests for a specified period, the concurrency limiter limits only the number of concurrent requests and doesn't cap the number of requests in a time period.
  • #24: The concurrency limiter limits the number concurrent requests. Each request reduces the concurrency limit by one. When a request completes, the limit is increased by one. Unlike the other requests limiters that limit the total number of requests for a specified period, the concurrency limiter limits only the number of concurrent requests and doesn't cap the number of requests in a time period.
  • #25: The concurrency limiter limits the number concurrent requests. Each request reduces the concurrency limit by one. When a request completes, the limit is increased by one. Unlike the other requests limiters that limit the total number of requests for a specified period, the concurrency limiter limits only the number of concurrent requests and doesn't cap the number of requests in a time period.
  • #28: C# 11 static abstract members – Ndepend
  • #32: C# 11 static abstract members – Ndepend
  • #34: C# 11 static abstract members – Ndepend
  • #37: C# 11 static abstract members – Ndepend
  • #40: C# 11 static abstract members – Ndepend
  • #42: C# 11 static abstract members – Ndepend