• Avalanche
  • Avalanche.Core
  • Lexical

    Show / Hide Table of Contents
    • Avalanche.Localization
      • Introduction
      • Localization
      • LocalizationFile
      • LocalizationFiles
      • LocalizationFileSystem
      • LocalizationFileFormat
      • LocalizationLine
      • LocalizationLines
      • TemplateFormat
      • CultureProvider
      • FallbackCultureProvider
      • ResourceManager
      • LocalizationError
      • Microsoft.Extensions
        • Introduction
        • DependencyInjection
        • FileProvider
        • Logging
        • ITextLocalizer
        • IFileLocalizer
        • Localization
        • AspNetCore
      • Pluralization
        • Introduction
        • Multiple plural parameters
        • Custom PluralRules
        • Invariant Culture
        • Unit Prefix
        • IPluralRule
        • IPluralNumber
        • IPluralRules
        • CLDRs
        • Unicode.CLDR41
        • Unicode.CLDR40
      • Articles
        • Alphabet localization
        • Benchmarks
        • Caching
        • Class Library
        • Demo
        • Diagnostics
        • Embedded resources
        • Emplacement
        • File localization
        • Text localization
    • Avalanche.Message
      • Introduction
      • IMessage
      • IMessageProvider
      • IMessageDescription
      • IMessageDescriptions
      • MessageLevel
      • Message printing
      • Messages and Exceptions
      • Logging
      • Validation
      • Localization
    • Avalanche.StatusCode
      • Introduction
      • HResult
        • Introduction
        • HResult.Facilities
        • BasicMessages
        • RpcMessages
        • DispatchMessages
        • ItfMessages
        • Win32Messages
        • ClrMessages
      • System
        • Introduction
        • AccessControlMessages
        • AggregateMessages
        • AppDomainMessages
        • ArgumentMessages
        • ArgumentNullMessages
        • ArgumentOutOfRangeMessages
        • ArithmeticMessages
        • ArrayMessages
        • AssemblyMessages
        • BadImageFormatMessages
        • CodeContractMessages
        • CodePageMessages
        • CollectionsMessages
        • CompilerServiceMessages
        • CryptographyMessages
        • CultureMessages
        • DiagnosticsMessages
        • EventSourceMessages
        • ExecutionEngineMessages
        • FormatMessages
        • HostProtectionMessages
        • IOMessages
        • IndexOutOfRangeMessages
        • InteropServiceMessages
        • InvalidCastMessages
        • InvalidOperationMessages
        • IsolatedStorageMessages
        • LazyMessages
        • MarshalerMessages
        • MemoryMessages
        • MiscellaneousMessages
        • NotImplementedMessages
        • NotSupportedMessages
        • ObjectDisposedMessages
        • OperationCanceledMessages
        • OverflowMessages
        • PlatformMessages
        • PolicyMessages
        • PrincipalMessages
        • ProgramMessages
        • ReferenceMessages
        • ReflectionMessages
        • RegionMessages
        • RemotingMessages
        • ResourcesMessages
        • SecurityMessages
        • SerializationMessages
        • StackMessages
        • TaskMessages
        • TextMessages
        • ThreadingMessages
        • TimeZoneMessages
        • TypeMessages
        • XmlMessages
    • Avalanche.Template
      • Introduction
      • TemplateFormats
      • ITemplatePrintable
      • ITemplateFormatPrintable
      • ITemplateText
      • ITemplateBreakdown
      • ITemplateFormat
      • ITemplateFormats
      • Extract Arguments
      • Emplacement
    • Avalanche.Tokenizer
      • Introduction
      • IToken
      • ITokenizer
      • Tokenizers
    • Avalanche.Service
      • Introduction
      • Service
        • IService
        • Construction
        • Query
        • CancellationToken
        • CachePolicy
        • Cast
        • Scope
        • Dispose
      • Handler
        • Introduction
        • IHandler
        • Cancel
        • Recursion
        • Cyclicity
        • Delegates
        • Casting
        • Invokable
        • Handlers
      • Request
        • Introduction
        • IRequest
        • [Request]
        • [ContextParameter]
        • Print Tree
      • Dependency Injection
        • Introduction
        • ServiceRequest<T>
        • Handler
        • CachePolicy
        • CancellationToken
        • QueryLogger
      • Examples
        • Expression Example
        • Mapper Example
      • ServiceMessages
    • Avalanche.Writer
      • Introduction
      • Writer
      • Referer
      • TypeCast
      • DefaultConstructor
      • DelegateWriter
      • WriterPipe
      • ConstantWriter
      • PassthroughWriter
      • Context
      • WriterMessages
    • Avalanche.Accessor
      • Introduction
      • AccessorServices
      • List
        • ListAccessor
        • ListConstructor
        • ListDeconstructor
        • ListDefaultConstructor
        • ListGet
        • ListSet
        • ListAdd
        • ListInsert
        • ListClear
        • ListCount
        • ListIndexOf
        • ListRemoveAt
        • ListReferer
      • Map
        • MapAccessor
        • MapConstructor
        • MapDeconstructor
        • MapDefaultConstructor
        • MapSet
        • MapGet
        • MapRemove
        • MapClear
        • MapCount
        • MapReferer
      • Record
        • RecordAccessor
        • RecordConstructor
        • RecordDeconstructor
        • RecordDefaultConstructor
      • Field
        • FieldAccessor
        • FieldReader
        • FieldWriter
        • FieldReferer
      • Dependency Injection
        • Introduction
      • AccessorMessages
    • Avalanche.Emit
      • Introduction
      • TypeBuilder
      • ConstructorBuilder
      • MethodBuilder
      • PropertyBuilder
      • FieldBuilder
      • Emit
      • Utilities
    • Avalanche.DataType
      • Introduction
      • IDataTypeBase
      • IDataType
      • IRecordType
      • IFieldType
      • IUnionType
      • IListType
      • IMapType
      • IValueType
      • IEnumerationType
      • IIntegerType
      • IRealType
      • IStringType
      • IAnyType
      • DataTypeRequest
      • PrintTree
      • DataTypeMessages
    • Avalanche.FileSystem
      • Introduction
      • Abstractions
        • IFileSystem
          • IFileSystemBrowse
          • IFileSystemCreateDirectory
          • IFileSystemDelete
          • IFileSystemFileAttribute
          • IFileSystemMount
          • IFileSystemMove
          • IFileSystemObserve
          • IFileSystemOpen
        • IEvent
        • IEntry
        • IOption
        • IToken
      • FileSystem
      • VirtualFileSystem
      • MemoryFileSystem
      • EmbeddedFileSystem
      • HttpFileSystem
      • Decoration
      • IFileProvider
      • Events
      • Utilities
        • Dispose
        • File Scanner
        • Visit Tree
        • File Operation
    • Avalanche.Identity
      • Introduction
      • Identity
      • IdentityParts
      • IdentityInterner
      • IdentityComparer
      • Print Tree
      • IdentityAccessors
        • Introduction
        • TypeName
    • Avalanche.Utilities
      • Introduction
      • Collections
        • Tuples
        • StructList
        • ArrayList
        • BijectionMap
        • LocakableDictionary
        • LockableList
        • MapList
        • Pipe
        • RingQueue
        • EnumerableExtensions
        • TupleUtilities
        • ArrayUtilities
      • Comparers
        • IGraphComparer
        • IGraphComparable
        • AlphaNumericComparer
        • EnumerableComparer
        • EnumerableGraphComparer
        • ReferenceComparer
        • KeyValuePairComparer
        • DefaultComparerProvider
        • RecordComparer
      • Cloners
        • ICloner
        • IGraphCloner
        • IGraphCloneable
        • EnumerableCloner
        • FieldCloner
        • PassthroughCloner
        • RecordCloner
        • ClonerProvider
      • Dispose
        • IDisposeAttachable
        • IDisposeBelatable
      • Provider
        • Introduction
        • ProviderBase
        • Delegate
        • Concatenation
        • Cache
        • ResultCapture
        • AsReadOnly
        • AsService
      • Record
        • IRecordDescription
        • IFieldDescription
        • IConstructorDescription
        • IConstructionDescription
        • IParameterDescription
        • IRecordProviders
        • RecordDelegates
          • RecordCreate
          • RecordClone
          • RecordCopy
          • IRecordDelegates
        • FieldDelegates
          • FieldRead
          • FieldWrite
          • RecreateWith
          • IFieldDelegates
      • String
        • IEscaper
        • UnicodeString
      • Miscellaneous
        • IIdGenerator
        • Permutation
        • IReadOnly
        • IUserDataContainer
        • Void
    • Avalanche.Core
      • License
      • Order

    IRequest

    IRequest is an optional indication that Type is a service request.

    /// <summary>
    /// Indicates that Type is a service request. 
    /// 
    /// Request implementations must be immutable or used as such.
    /// 
    /// See sub-interfaces:
    ///     <see cref="IRequestForType"/>
    ///     <see cref="IRequestFor{Value}"/>
    ///     <see cref="IRequestInvocation"/>
    ///     <see cref="IRequestToBeCached"/>
    ///     <see cref="IRequestNotToBeCached"/>
    /// </summary>
    public interface IRequest { }
    
    IRequest
    ├── IRequestForType
    ├── IRequestForT
    │   └── IRequestFor<Response>
    │       └── IRequestForInvocation
    │
    ├── IRequestToBeDisposed
    ├── IRequestNotToBeDisposed
    ├── IRequestToBeCached
    └── IRequestNotToBeCached
    

    IRequestFor<T>

    IRequestFor<T> indicates result type of the request.

    /// <summary>
    /// Indicates that there is a specific result type.
    /// 
    /// The implementing class implements either <see cref="IRequestForType"/> or <see cref="IRequestFor{ResultType}"/>.
    /// </summary>
    public interface IRequestFor : IRequest { }
    
    /// <summary>Indicates that there is a specific result type.</summary>
    public interface IRequestForType : IRequestFor
    {
        /// <summary>Get Result Type, if available</summary>
        Type? ResultType { get; }
    }
    
    /// <summary>
    /// Indicates that there is a specific result type in subinterface <see cref="IRequestFor{ResultType}"/>.
    /// 
    /// This implementing class implements <see cref="IRequestFor{ResultType}"/>.
    /// </summary>
    public interface IRequestForT : IRequestFor { }
    
    /// <summary>Indicates expected result type.</summary>
    /// <typeparam name="ResultType"></typeparam>
    public interface IRequestFor<out ResultType> : IRequest, IRequestForT { }
    
    /// <summary>Request to invocate action. </summary>
    public interface IRequestInvocation : IRequestFor<Avalanche.Void> { }
    

    Request class inherites IRequestFor<T> to indicate result type.

    /// <summary>Request to print record-like object as json-string</summary>
    public record PrintAsJson(Object record) : IRequestFor<string>;
    

    Another way to indicate with property IRequestForType.ResultType.

    /// <summary>Request to print record-like object as json-string</summary>
    public record PrintAsJson(Object record) : IRequestForType
    {
        Type? IRequestForType.ResultType => typeof(string);
    }
    

    IRequestToBeCached

    IRequestToBeCached indicates that request is to be cached.

    /// <summary>Indicates that the request is to be cached. Requires <see cref="CachePolicies.Default"/>, <see cref="CachePolicies.DefaultYes"/> or <see cref="CachePolicies.UseInterface"/>.</summary>
    public interface IRequestToBeCached : IRequest { }
    
    /// <summary>Request to print record-like object as json-string</summary>
    public record PrintAsJson(Object record) : IRequestToBeCached;
    

    IRequestNotToBeCached indicates that request is not to be cached.

    /// <summary>Indicates that the request is not to be cached. Requires <see cref="CachePolicies.Default"/>, <see cref="CachePolicies.DefaultYes"/> or <see cref="CachePolicies.UseInterface"/>.</summary>
    public interface IRequestNotToBeCached : IRequest { }
    
    /// <summary>Request to print record-like object as json-string</summary>
    public record PrintAsJson(Object record) : IRequestNotToBeCached;
    

    IRequestToBeDisposed

    IRequestToBeDisposed indicates that the result object from this request is to be disposed along service or its cache. Note that, this is however default behaviour with default entry policy, even without the interface.

    /// <summary>Indicates that if the result of this request is cached and is disposable, then it is to be disposed. Requires <see cref="EntryPolicies.Default"/> or <see cref="EntryPolicies.UseInterface"/> entry policy.</summary>
    public interface IRequestToBeDisposed : IRequest { }
    
    /// <summary>Request to print record-like object as json-string</summary>
    public record PrintAsJson(Object record) : IRequestToBeDisposed;
    

    IRequestNotToBeDisposed indicates that the result object from this request is not to be disposed. This overrides the default behaviour.

    /// <summary>Indicates that the result of this request is not to be disposed. Requires <see cref="EntryPolicies.Default"/> or <see cref="EntryPolicies.UseInterface"/>.</summary>
    public interface IRequestNotToBeDisposed : IRequest { }
    
    /// <summary>Request to print record-like object as json-string</summary>
    public record PrintAsJson(Object record) : IRequestNotToBeDisposed;
    

    IRequestNotToBeDisposed and IRequestToBeDisposed require that EntryPolicies.Default or EntryPolicies.UseInterface are used, and they are applied with default settings.

    Full Example

    Full example
    using System;
    using Avalanche.Service;
    
    public class request_irequest
    {
        public static void Run()
        {
            {
                // <01>
                // </01>
            }
        }
    
        static class _11
        {
            // <11>
            /// <summary>Request to print record-like object as json-string</summary>
            public record PrintAsJson(Object record) : IRequestFor<string>;
            // </11>
        }
        static class _12
        {
            // <12>
            /// <summary>Request to print record-like object as json-string</summary>
            public record PrintAsJson(Object record) : IRequestForType
            {
                Type? IRequestForType.ResultType => typeof(string);
            }
            // </12>
        }
    
        static class _21
        {
            // <21>
            /// <summary>Request to print record-like object as json-string</summary>
            public record PrintAsJson(Object record) : IRequestToBeCached;
            // </21>
        }
    
        static class _22
        {
            // <22>
            /// <summary>Request to print record-like object as json-string</summary>
            public record PrintAsJson(Object record) : IRequestNotToBeCached;
            // </22>
        }
    
        static class _31
        {
            // <31>
            /// <summary>Request to print record-like object as json-string</summary>
            public record PrintAsJson(Object record) : IRequestToBeDisposed;
            // </31>
        }
    
        static class _32
        {
            // <32>
            /// <summary>Request to print record-like object as json-string</summary>
            public record PrintAsJson(Object record) : IRequestNotToBeDisposed;
            // </32>
        }
    
    
    
    }
    
    Back to top Copyright © 2022 Toni Kalajainen, contact@avalanche.fi