EyeAuras Docs EyeAuras Docs
EyeAuras Docs EyeAuras Docs
DocFX + Singulink = ♥

Search Results for

    Class SharedResource<T>

    Manages a shared resource of type T, providing controlled access and ensuring efficient reuse. This class is designed to handle scenarios where a resource is expensive to create and should be reused for as long as it is viable. The resource is created upon first request and subsequently "rented" out for use. The class ensures that the same resource instance is reused across multiple requests, maximizing efficiency.

    Inheritance
    object
    DisposableReactiveObject
    SharedResource<T>
    Implements
    IDisposable
    INotifyPropertyChanged
    Inherited Members
    object.GetType()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: PoeShared.Services
    Assembly: PoeShared.dll
    Syntax
    public sealed class SharedResource<T> : DisposableReactiveObject, IDisposable, INotifyPropertyChanged where T : SharedResourceBase
    Type Parameters
    Name Description
    T

    The type of the shared resource. Must be a subclass of SharedResourceBase.

    Remarks

    The SharedResource<T> class is especially useful in situations where resource creation is costly, such as network connections, database connections, or large data structures. It ensures that the overhead of creating such resources is incurred only once and the resource is reused until it is no longer valid or the SharedResource<T> itself is disposed.

    The class also manages the lifecycle of the resource. The resource is expected to remain alive and usable until the SharedResource<T> class is disposed. Upon disposal, the SharedResource<T> class disposes of the managed resource as well, ensuring proper cleanup. If the resource disposes itself or becomes unusable (e.g., a network connection is lost), the class will automatically create a new instance of the resource upon the next request.

    The class employs thread-safe mechanisms to ensure that the resource can be accessed concurrently from multiple threads without race conditions. This makes it suitable for use in multi-threaded environments.

    Constructors

    Name Description
    SharedResource(Func<T>)

    Initializes a new instance of the SharedResource<T> class.

    Properties

    Name Description
    IsRented

    Gets a value indicating whether the current instance of the shared resource is rented.

    Methods

    Name Description
    RentOrCreate()

    Rents the current instance of the shared resource or creates a new one if necessary.

    Extension Methods

    ReactiveObjectExtensions.Listen<TContext, TItem>(TContext, Expression<Func<TContext, IObservableList<TItem>>>)
    ReactiveObjectExtensions.Listen<TContext, TOut>(TContext, Expression<Func<TContext, TOut>>)
    ReactiveObjectExtensions.Listen<TContext, TOut1, TOut2>(TContext, Expression<Func<TContext, TOut1>>, Expression<Func<TContext, TOut2>>)
    ReactiveObjectExtensions.Listen<TContext, TOut1, TOut2, TOut3>(TContext, Expression<Func<TContext, TOut1>>, Expression<Func<TContext, TOut2>>, Expression<Func<TContext, TOut3>>)
    ReactiveObjectExtensions.Listen<TContext, TOut1, TOut2, TOut3, TOut4>(TContext, Expression<Func<TContext, TOut1>>, Expression<Func<TContext, TOut2>>, Expression<Func<TContext, TOut3>>, Expression<Func<TContext, TOut4>>)
    DisposableExtensions.AssignTo<T>(T, SerialDisposable)
    NotifyPropertyChangedExtensions.GetPropertyName<TObject, T1>(TObject, Expression<Func<TObject, T1>>)
    NotifyPropertyChangedExtensions.TryWaitForValue<TObject, T1>(TObject, Expression<Func<TObject, T1>>, Predicate<T1>, TimeSpan)
    NotifyPropertyChangedExtensions.WaitForAsync<TObject, T1>(TObject, Func<TObject, T1>, Predicate<T1>, TimeSpan)
    NotifyPropertyChangedExtensions.WaitForValueAsync<TObject, T1>(TObject, Expression<Func<TObject, T1>>, Predicate<T1>, TimeSpan)
    NotifyPropertyChangedExtensions.WaitForValue<TObject, T1>(TObject, Expression<Func<TObject, T1>>, Predicate<T1>, TimeSpan)
    NotifyPropertyChangedExtensions.WhenAnyProperty<TObject>(TObject, params string[])
    NotifyPropertyChangedExtensions.WhenAnyProperty<TObject, T1>(TObject, Expression<Func<TObject, T1>>)
    NotifyPropertyChangedExtensions.WhenAnyProperty<TObject, T1, T2>(TObject, Expression<Func<TObject, T1>>, Expression<Func<TObject, T2>>)
    NotifyPropertyChangedExtensions.WhenAnyProperty<TObject, T1, T2, T3>(TObject, Expression<Func<TObject, T1>>, Expression<Func<TObject, T2>>, Expression<Func<TObject, T3>>)
    NotifyPropertyChangedExtensions.WhenAnyProperty<TObject, T1, T2, T3, T4>(TObject, Expression<Func<TObject, T1>>, Expression<Func<TObject, T2>>, Expression<Func<TObject, T3>>, Expression<Func<TObject, T4>>)
    NotifyPropertyChangedExtensions.WhenAnyProperty<TObject, T1, T2, T3, T4, T5>(TObject, Expression<Func<TObject, T1>>, Expression<Func<TObject, T2>>, Expression<Func<TObject, T3>>, Expression<Func<TObject, T4>>, Expression<Func<TObject, T5>>)
    ObjectExtensions.AddTo<TItem, TCollection>(TItem, ISourceList<TCollection>)
    ObjectExtensions.AddTo<TItem, TCollection>(TItem, ICollection<TCollection>)
    ObjectExtensions.CloneJson<T>(T)
    ObjectExtensions.CopyPropertiesTo<TSource, TTarget>(TSource, TTarget)
    ObjectExtensions.DumpToTextRaw<T>(T)
    ObjectExtensions.DumpToText<T>(T)
    ObjectExtensions.Dump<T>(T)
    ObjectExtensions.EvalOrDefault<T, TValue>(T, Func<T, TValue>, TValue)
    ObjectExtensions.Eval<T, TValue>(T, Func<T, TValue>)
    ObjectExtensions.GetPropertyAccessor<TSource, TValue>(TSource, Expression<Func<TSource, TValue>>)
    ObjectExtensions.InsertTo<TItem, TCollection>(TItem, IList<TCollection>, int)
    ObjectExtensions.ToJson<T>(T)
    ObjectExtensions.ToStringSafe<T>(T)
    ObjectExtensions.TransferPropertiesTo<TSource, TTarget>(TSource, TTarget, params string[])
    ReactiveObjectExtensions.BindPropertyTo<TSource, TTarget, TSourceProperty, TTargetProperty>(TTarget, Expression<Func<TTarget, TTargetProperty>>, TSource, Expression<Func<TSource, TSourceProperty>>)
    ReactiveObjectExtensions.BindPropertyTo<TSource, TTarget, TSourceProperty, TTargetProperty>(TTarget, Expression<Func<TTarget, TTargetProperty>>, TSource, Expression<Func<TSource, TSourceProperty>>, IScheduler)
    ReactiveObjectExtensions.LinkObjectProperties<TSource, TSourceProperty, TTargetProperty>(TSource, Expression<Func<TSource, TSourceProperty>>, Expression<Func<TSource, TTargetProperty>>)
    ReactiveObjectExtensions.RaiseIfChanged<TSource, TSourceProperty>(TSource, string, TSourceProperty, TSourceProperty)
    ReactiveObjectExtensions.RaiseWhenSourceValue<TSource, TTarget, TSourceProperty, TTargetProperty>(TTarget, Expression<Func<TTarget, TTargetProperty>>, TSource, Expression<Func<TSource, TSourceProperty>>, IScheduler)
    ReactiveObjectExtensions.ToPropertyHelper<TSource, TSourceProperty>(TSource, Expression<Func<TSource, TSourceProperty>>, IObservable<TSourceProperty>, IScheduler)
    ReactiveObjectExtensions.ToProperty<TSource, TSourceProperty>(TSource, Expression<Func<TSource, TSourceProperty>>, IObservable<TSourceProperty>, TSourceProperty, bool, IScheduler)
    XDocumentExtensions.AddTo<T>(T, XContainer)
    DisposableExtensions.ToObservable(IDisposable)
    ObjectExtensions.GetPropertyAccessor<TValue>(object, string)
    ObjectReflectionExtensions.GetPropertyTypeOrDefault(object, string)
    ObjectReflectionExtensions.GetPropertyValue<T>(object, string)
    ObjectReflectionExtensions.SetPropertyValue<T>(object, string, T)
    © Xab3r. All rights reserved.