IServiceContainer
IServiceContainer is interface for classes that can hold IServiceBase.
/// <summary>Indicates that class binds a <see cref="IService"/> instance.</summary>
public interface IServiceContainer
{
/// <summary>Attached <see cref="IService"/>. </summary>
/// <exception cref="InvalidOperationException">If setting on read-only container.</exception>
IService Service { get; set; }
}
.SetService() assigns service to an instance that implements IServiceContainer.
// Create service
IService service = Services.Create(ServiceHandlers.Instance, CachePolicies.Default);
// Create accessor, and assign service
IAnyAccessor anyAccessor = new AnyAccessor().SetService(service);
Full Example
Full example
using System;
using Avalanche.Accessor;
using Avalanche.Service;
public class service_container
{
public static void Run()
{
{
// <01>
// Create service
IService service = Services.Create(ServiceHandlers.Instance, CachePolicies.Default);
// Create accessor, and assign service
IAnyAccessor anyAccessor = new AnyAccessor().SetService(service);
// </01>
}
}
}