Introduction to ASP.NET Core Minimal APIs
-
Introduction to ASP.NET Core Minimal APIs[^]
Quote:
In recent .NET versions, there’s a new way to build JSON-based APIs with ASP.NET Core: Minimal APIs.
I thought "Minimal APIs" have been around a while. Did a quick search in "Insider News" for "Minimal API" and found several mentions going back a few years. Maybe it's d different this time around because of "top level" ( X|) statements?
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
-
Introduction to ASP.NET Core Minimal APIs[^]
Quote:
In recent .NET versions, there’s a new way to build JSON-based APIs with ASP.NET Core: Minimal APIs.
I thought "Minimal APIs" have been around a while. Did a quick search in "Insider News" for "Minimal API" and found several mentions going back a few years. Maybe it's d different this time around because of "top level" ( X|) statements?
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
If you're interested in the guts of how they work, Andrew Lock posted an excellent eight-part blog series with the gory details: A first look behind the scenes of minimal API endpoints[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Introduction to ASP.NET Core Minimal APIs[^]
Quote:
In recent .NET versions, there’s a new way to build JSON-based APIs with ASP.NET Core: Minimal APIs.
I thought "Minimal APIs" have been around a while. Did a quick search in "Insider News" for "Minimal API" and found several mentions going back a few years. Maybe it's d different this time around because of "top level" ( X|) statements?
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
if (result is Ok { Value : { } } hugged)
hugged.Value.Timestamp = DateTime.UtcNow;I've never seen that syntax. :omg:
Latest Articles:
A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity Framework -
if (result is Ok { Value : { } } hugged)
hugged.Value.Timestamp = DateTime.UtcNow;I've never seen that syntax. :omg:
Latest Articles:
A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity FrameworkIt would arguably be better to use:
if (result is Ok<Hugged> { Value: { } hugged })
hugged.Timestamp = DateTime.UtcNow;Patterns - Pattern matching using the is and switch expressions. | Microsoft Learn[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
if (result is Ok { Value : { } } hugged)
hugged.Value.Timestamp = DateTime.UtcNow;I've never seen that syntax. :omg:
Latest Articles:
A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity Framework