![]() |
VOOZH | about |
dotnet add package Schema.NET.Pending --version 13.0.0
NuGet\Install-Package Schema.NET.Pending -Version 13.0.0
<PackageReference Include="Schema.NET.Pending" Version="13.0.0" />
<PackageVersion Include="Schema.NET.Pending" Version="13.0.0" />Directory.Packages.props
<PackageReference Include="Schema.NET.Pending" />Project file
paket add Schema.NET.Pending --version 13.0.0
#r "nuget: Schema.NET.Pending, 13.0.0"
#:package Schema.NET.Pending@13.0.0
#addin nuget:?package=Schema.NET.Pending&version=13.0.0Install as a Cake Addin
#tool nuget:?package=Schema.NET.Pending&version=13.0.0Install as a Cake Tool
👁 Schema.NET NuGet Package
👁 Schema.NET NuGet Package Downloads
👁 Twitter URL
👁 Twitter Follow
Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD and XML, typically used to represent structured data in the head section of html page.
var website = new WebSite()
{
AlternateName = "An Alternative Name",
Name = "Your Site Name",
Url = new Uri("https://example.com")
};
var jsonLd = website.ToString();
The code above outputs the following JSON-LD:
{
"@context":"https://schema.org",
"@type":"WebSite",
"alternateName":"An Alternative Name",
"name":"Your Site Name",
"url":"https://example.com"
}
If writing the result into a <script> element, be sure to use the .ToHtmlEscapedString() method instead to avoid exposing your website to a Cross-Site Scripting attack. See the example below.
schema.org defines a set of standard classes and their properties for objects and services in the real world. This machine readable format is a common standard used across the web for describing things.
Websites can define Structured Data in the head section of their html to enable search engines to show richer information in their search results. Here is an example of how Google can display extended metadata about your site in it's search results.
Using structured data in html requires the use of a script tag with a MIME type of application/ld+json like so:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://www.example.com",
"name": "Unlimited Ball Bearings Corp.",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-401-555-1212",
"contactType": "Customer service"
}
}
</script>
When serializing the result for a website's <script> tag, you should use the alternate .ToHtmlEscapedString() to avoid exposing yourself to a Cross-Site Scripting (XSS) vulnerability if some of the properties in your schema have been set from untrusted sources.
Usage in an ASP.NET MVC project might look like this:
<script type="application/ld+json">
@Html.Raw(Model.Schema.ToHtmlEscapedString())
</script>
Windows UWP apps let you share data using schema.org classes. Here is an example showing how to share metadata about a book.
schema.org defines classes and properties, where each property can have a single value or an array of multiple values. Additionally, properties can have multiple types e.g. an Address property could have a type of string or a type of PostalAddress which has it's own properties such as StreetAddress or PostalCode which breaks up an address into it's constituent parts.
To facilitate this Schema.NET uses some clever C# generics and implicit type conversions so that setting a single or multiple values is possible and that setting a string or PostalAddress is also possible:
// Single string address
var organization = new Organization()
{
Address = "123 Old Kent Road E10 6RL"
};
// Multiple string addresses
var organization = new Organization()
{
Address = new List<string>()
{
"123 Old Kent Road E10 6RL",
"456 Finsbury Park Road SW1 2JS"
}
};
// Single PostalAddress address
var organization = new Organization()
{
Address = new PostalAddress()
{
StreetAddress = "123 Old Kent Road",
PostalCode = "E10 6RL"
}
};
// Multiple PostalAddress addresses
var organization = new Organization()
{
Address = new List<PostalAddress>()
{
new PostalAddress()
{
StreetAddress = "123 Old Kent Road",
PostalCode = "E10 6RL"
},
new PostalAddress()
{
StreetAddress = "456 Finsbury Park Road",
PostalCode = "SW1 2JS"
}
}
};
// Mixed Author types
var book = new Book()
{
Author = new List<object>()
{
new Organization() { Name = "Penguin" },
new Person() { Name = "J.D. Salinger" }
}
};
// Deconstruct a property containing mixed types
if (book.Author.HasValue)
{
var (organisations, people) = book.Author.Value;
}
This magic is all carried out using implicit conversion operators in the OneOrMany<T>, Values<T1, T2>, Values<T1, T2, T3> and Values<T1, T2, T3, T4> types. These types are all structs for best performance too.
For more examples and actual running code samples, take a look at the unit tests in the project source code.
There are many pending types on schema.org which are not yet fully formed and ready for production. If you need to use these, you can install the Schema.NET.Pending NuGet package instead of Schema.NET. This package contains all released schema types as well as all pending types.
👁 Schema.NET.Pending NuGet Package
👁 Schema.NET.Pending NuGet Package Downloads
| Name | Operating System | Status | History |
|---|---|---|---|
| Azure Pipelines | Ubuntu | 👁 Azure Pipelines Ubuntu Build Status |
|
| Azure Pipelines | Mac | 👁 Azure Pipelines Mac Build Status |
|
| Azure Pipelines | Windows | 👁 Azure Pipelines Windows Build Status |
|
| Azure Pipelines | Overall | 👁 Azure Pipelines Overall Build Status |
👁 Azure DevOps Build History |
| GitHub Actions | Ubuntu, Mac & Windows | 👁 GitHub Actions Status |
👁 GitHub Actions Build History |
| AppVeyor | Ubuntu, Mac & Windows | 👁 AppVeyor Build Status |
👁 AppVeyor Build History |
Please view the contributing guide for more information.
System.Text.Json support, Had all types implement IEquatable<T> GetHashCode and added extra unit tests and bug fixes.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on Schema.NET.Pending:
| Package | Downloads |
|---|---|
|
Deploy.LaunchPad.Core.Abp
Shared code for LaunchPad framework using AspnetBoilerplate. |
|
|
Deploy.LaunchPad.Organizations
Organization-related code for LaunchPad framework. |
|
|
Olympus.Web
Package Description |
|
|
Umbraco.Community.SchemeWeaver
Map Umbraco Content Types to Schema.org types and automatically generate JSON-LD structured data for your pages. Backoffice UI, auto-mapping, Delivery API integration, and a Razor tag helper. |
This package is not used by any popular GitHub repositories.