| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | #if !BUILDING_SOURCE_GENERATOR |
| | | 5 | | using System.Text.Json.Serialization.Metadata; |
| | | 6 | | #endif |
| | | 7 | | |
| | | 8 | | namespace System.Text.Json.Serialization |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Instructs the System.Text.Json source generator to generate source code to help optimize performance |
| | | 12 | | /// when serializing and deserializing instances of the specified type and types in its object graph. |
| | | 13 | | /// </summary> |
| | | 14 | | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] |
| | | 15 | | |
| | | 16 | | #if BUILDING_SOURCE_GENERATOR |
| | | 17 | | internal |
| | | 18 | | #else |
| | | 19 | | public |
| | | 20 | | #endif |
| | | 21 | | sealed class JsonSerializableAttribute : JsonAttribute |
| | | 22 | | { |
| | | 23 | | #pragma warning disable IDE0060 |
| | | 24 | | /// <summary> |
| | | 25 | | /// Initializes a new instance of <see cref="JsonSerializableAttribute"/> with the specified type. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <param name="type">The type to generate source code for.</param> |
| | 0 | 28 | | public JsonSerializableAttribute(Type type) { } |
| | | 29 | | #pragma warning restore IDE0060 |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// The name of the property for the generated <see cref="JsonTypeInfo{T}"/> for |
| | | 33 | | /// the type on the generated, derived <see cref="JsonSerializerContext"/> type. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <remarks> |
| | | 36 | | /// Useful to resolve a name collision with another type in the compilation closure. |
| | | 37 | | /// </remarks> |
| | 0 | 38 | | public string? TypeInfoPropertyName { get; set; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Determines what the source generator should generate for the type. If the value is <see cref="JsonSourceGene |
| | | 42 | | /// then the setting specified on <see cref="JsonSourceGenerationOptionsAttribute.GenerationMode"/> will be used |
| | | 43 | | /// </summary> |
| | 0 | 44 | | public JsonSourceGenerationMode GenerationMode { get; set; } |
| | | 45 | | } |
| | | 46 | | } |