concept api in category asp.net

appears as: APIs, APIs, n API, API, API, The APIs
ASP.NET Core in Action

This is an excerpt from Manning's book ASP.NET Core in Action.

It’s important to be aware of the limitations of cross-platform applications—not all the .NET Framework APIs are available in .NET Core. It’s likely that most of the APIs you need will make their way to .NET Core over time, but it’s an important point to be aware of. See the “Choosing a platform for ASP.NET Core” section later in this chapter to determine if cross-platform is a viable option for your application.

PCLs were introduced to make the process of compiling and sharing code between multiple platforms simpler. When creating a library, developers could specify the platforms they wanted to support, and the project would only have access to the set of APIs common among all of them. Each additional platform supported would reduce the API surface to only those APIs available in all the selected platforms, as shown in figure A.2.

Figure A.2. Each additional framework that must be supported by a PCL reduces the APIs available to your application.

To create a PCL library, you’d create a library that targeted a specific PCL profile. This profile contained a precomputed list of APIs known to be available on the associated platforms. That way, you could create one library that you could share across your selected platforms. You could have a single project and a single resulting package—no copy and paste or duplicate projects required.

  • PCLs— A PCL profile targets a specific set of platforms. The APIs available to a PCL library are the common APIs shared by all the platforms in the profile.
  • .NET Standard— A .NET Standard version defines a specific set of APIs. These APIs are always available in a .NET Standard library. Any platform that implements all these APIs supports that version of .NET Standard.
  • .NET Standard isn’t something you download. Instead, it’s a list of APIs that a .NET Standard-compatible platform must implement. You can create libraries that target .NET Standard, and you can use that library in any app that targets a .NET Standard-compatible platform.

    Listing A.1. An interpretation of .NET Standard in C#
    interface NETStandard1_0 #1 { void SomeMethod(); } interface NETStandard1_1 : NETStandard1_0 #2 { void OtherMethod(); #3 } interface NETStandard1_2 : NETStandard1_1 #4 { void YetAnotherMethod(){ /* Method implementation */ } #5 } class Windows8 : NETStandard1_1 #6 { void SomeMethod () { /* Method implementation */ } #7 void OtherMethod(); #7 void ADifferentMethod() { /* Method implementation */ #8 } class WindowsPhone81 : NETStandard1_2 #9 { void SomeMethod () { /* Method implementation */ } #10 void OtherMethod() { /* Method implementation */ } #10 void YetAnotherMethod () { /* Method implementation */ } #10 void ExtraMethod1() { /* Method implementation */ } #11 void ExtraMethod2() { /* Method implementation */ } #11 } #1 Defines the APIs available in .NET Standard 1.0 #2 .NET Standard 1.1 inherits all the APIs from .NET Standard 1.0. #3 APIs available in .NET Standard 1.1 but not in 1.0 #4 .NET Standard 1.2 inherits all the APIs from .NET Standard 1.1. #5 APIs available in .NET Standard 1.2 but not in 1.1 or 1.0 #6 Windows 8.0 implements .NET Standard 1.1. #7 Implementations of the APIs required by .NET Standard 1.1 and 1.0 #8 Additional APIs that aren’t part of .NET Standard, but exist on the Windows 8.0 platform #9 Windows Phone 8.1 implements .NET Standard 1.2 #10 Implementations of the APIs required by .NET Standard 1.2, 1.1, and 1.0 #11 Additional APIs that aren’t part of .NET Standard, but exist on the Windows Phone 8.1 platform !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":61},{\"line\":0,\"ch\":63}],[{\"line\":25,\"ch\":61},{\"line\":25,\"ch\":63}],[{\"line\":26,\"ch\":61},{\"line\":26,\"ch\":63}],[{\"line\":27,\"ch\":61},{\"line\":27,\"ch\":63}],[{\"line\":29,\"ch\":61},{\"line\":29,\"ch\":63}],[{\"line\":30,\"ch\":61},{\"line\":30,\"ch\":63}],[{\"line\":33,\"ch\":0},{\"line\":33,\"ch\":2}],[{\"line\":42,\"ch\":0},{\"line\":42,\"ch\":2}],[{\"line\":43,\"ch\":0},{\"line\":43,\"ch\":2}],[{\"line\":5,\"ch\":61},{\"line\":5,\"ch\":63}],[{\"line\":34,\"ch\":0},{\"line\":34,\"ch\":2}],[{\"line\":7,\"ch\":61},{\"line\":7,\"ch\":63}],[{\"line\":35,\"ch\":0},{\"line\":35,\"ch\":2}],[{\"line\":10,\"ch\":61},{\"line\":10,\"ch\":63}],[{\"line\":36,\"ch\":0},{\"line\":36,\"ch\":2}],[{\"line\":12,\"ch\":61},{\"line\":12,\"ch\":63}],[{\"line\":37,\"ch\":0},{\"line\":37,\"ch\":2}],[{\"line\":15,\"ch\":61},{\"line\":15,\"ch\":63}],[{\"line\":38,\"ch\":0},{\"line\":38,\"ch\":2}],[{\"line\":17,\"ch\":61},{\"line\":17,\"ch\":63}],[{\"line\":18,\"ch\":61},{\"line\":18,\"ch\":63}],[{\"line\":39,\"ch\":0},{\"line\":39,\"ch\":2}],[{\"line\":17,\"ch\":61},{\"line\":17,\"ch\":63}],[{\"line\":18,\"ch\":61},{\"line\":18,\"ch\":63}],[{\"line\":39,\"ch\":0},{\"line\":39,\"ch\":2}],[{\"line\":20,\"ch\":61},{\"line\":20,\"ch\":63}],[{\"line\":40,\"ch\":0},{\"line\":40,\"ch\":2}],[{\"line\":23,\"ch\":61},{\"line\":23,\"ch\":63}],[{\"line\":41,\"ch\":0},{\"line\":41,\"ch\":2}],[{\"line\":25,\"ch\":61},{\"line\":25,\"ch\":64}],[{\"line\":26,\"ch\":61},{\"line\":26,\"ch\":64}],[{\"line\":27,\"ch\":61},{\"line\":27,\"ch\":64}],[{\"line\":42,\"ch\":0},{\"line\":42,\"ch\":3}],[{\"line\":25,\"ch\":61},{\"line\":25,\"ch\":64}],[{\"line\":26,\"ch\":61},{\"line\":26,\"ch\":64}],[{\"line\":27,\"ch\":61},{\"line\":27,\"ch\":64}],[{\"line\":42,\"ch\":0},{\"line\":42,\"ch\":3}],[{\"line\":25,\"ch\":61},{\"line\":25,\"ch\":64}],[{\"line\":26,\"ch\":61},{\"line\":26,\"ch\":64}],[{\"line\":27,\"ch\":61},{\"line\":27,\"ch\":64}],[{\"line\":42,\"ch\":0},{\"line\":42,\"ch\":3}],[{\"line\":29,\"ch\":61},{\"line\":29,\"ch\":64}],[{\"line\":30,\"ch\":61},{\"line\":30,\"ch\":64}],[{\"line\":43,\"ch\":0},{\"line\":43,\"ch\":3}],[{\"line\":29,\"ch\":61},{\"line\":29,\"ch\":64}],[{\"line\":30,\"ch\":61},{\"line\":30,\"ch\":64}],[{\"line\":43,\"ch\":0},{\"line\":43,\"ch\":3}]]"} !@%STYLE%@!