| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using System.ComponentModel; |
| | | 4 | | |
| | | 5 | | namespace IceRpc.Slice.Operations; |
| | | 6 | | |
| | | 7 | | /// <summary>An attribute that IceRpc.Slice.Generator applies to abstract methods it generates on server-side |
| | | 8 | | /// interfaces (I{Name}Service). This attribute communicates information about the Slice operation to the IceRPC |
| | | 9 | | /// Service Generator (IceRpc.ServiceGenerator): the name of the Slice operation plus various optional properties |
| | | 10 | | /// (see below). The Service Generator generates code that matches the operation name in incoming requests to the |
| | | 11 | | /// operation name specified by this attribute.</summary> |
| | | 12 | | /// <remarks>We limit the information communicated through this attribute to the strict minimum. The Service Generator |
| | | 13 | | /// can deduce most information from the signature of the method decorated with this attribute, such as the number of |
| | | 14 | | /// parameters and their mapped types.</remarks> |
| | | 15 | | [AttributeUsage(AttributeTargets.Method, Inherited = false)] |
| | | 16 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | | 17 | | public sealed class SliceOperationAttribute : Attribute |
| | | 18 | | { |
| | | 19 | | /// <summary>Gets the operation name.</summary> |
| | | 20 | | /// <value>The operation name.</value> |
| | 0 | 21 | | public string Name { get; } |
| | | 22 | | |
| | | 23 | | /// <summary>Gets a value indicating whether the return value needs to be compressed.</summary> |
| | | 24 | | /// <value><see langword="true"/> if the return value needs to be compressed; otherwise, <see langword="false"/>. |
| | | 25 | | /// </value> |
| | 0 | 26 | | public bool CompressReturn { get; init; } |
| | | 27 | | |
| | | 28 | | /// <summary>Gets a value indicating whether the non-stream portion of the return value is pre-encoded by the |
| | | 29 | | /// application.</summary> |
| | | 30 | | /// <value><see langword="true"/> if the non-stream portion of the return value is pre-encoded; otherwise, |
| | | 31 | | /// <see langword="false"/>.</value> |
| | 0 | 32 | | public bool EncodedReturn { get; init; } |
| | | 33 | | |
| | | 34 | | /// <summary>Gets a value indicating whether the operation is idempotent.</summary> |
| | | 35 | | /// <value><see langword="true"/> if the operation is idempotent; otherwise, <see langword="false"/>.</value> |
| | 0 | 36 | | public bool Idempotent { get; init; } |
| | | 37 | | |
| | | 38 | | /// <summary>Constructs a Slice operation attribute.</summary> |
| | | 39 | | /// <param name="name">The operation name.</param> |
| | 0 | 40 | | public SliceOperationAttribute(string name) => Name = name; |
| | | 41 | | } |