<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

WebApiServiceBase

abstract class WebApiServiceBase
Represents an abstract class service object for WebAPI-based wrappers.
using Relativity.DataExchange.Logger; using Relativity.Logging; using System; using System.Net; namespace Relativity.DataExchange.Service { internal abstract class WebApiServiceBase { private static readonly IObjectCacheRepository DefaultObjectCacheRepository = new MemoryCacheRepository(); private readonly ILog logger; private bool initialized; protected IAppSettings AppSettings { get; } protected IObjectCacheRepository CacheRepository { get; } protected RelativityInstanceInfo InstanceInfo { get; } protected WebApiServiceBase(RelativityInstanceInfo instanceInfo) : this(instanceInfo, DefaultObjectCacheRepository, Relativity.DataExchange.AppSettings.Instance) { } protected WebApiServiceBase(RelativityInstanceInfo instanceInfo, IObjectCacheRepository repository, IAppSettings appSettings) { if (instanceInfo == null) throw new ArgumentNullException("instanceInfo"); if (repository == null) throw new ArgumentNullException("repository"); if (appSettings == null) throw new ArgumentNullException("appSettings"); if (instanceInfo.WebApiServiceUrl == (Uri)null) throw new ArgumentException("The WebApiServiceUrl must be non-null.", "instanceInfo"); if (instanceInfo.Credentials == null) throw new ArgumentException("The Credentials must be non-null.", "instanceInfo"); if (instanceInfo.CookieContainer == null) throw new ArgumentException("The CookieContainer must be non-null.", "instanceInfo"); AppSettings = appSettings; CacheRepository = repository; InstanceInfo = instanceInfo; logger = RelativityLogger.Instance; } protected void Initialize() { if (!initialized) { ServicePointManager.SecurityProtocol = (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12); initialized = true; } } protected void LogInformation(string messageTemplate, params object[] propertyValues) { logger.LogInformation(messageTemplate, propertyValues); } protected void LogError(Exception exception, string messageTemplate, params object[] propertyValues) { logger.LogError(exception, messageTemplate, propertyValues); } } }