private void CreateChunkHandlerManager(ServiceContainer services) { var handlers = _handlerTypes .Select(t => CreateInstance(t, null)) .Cast <IFileChunkHandler>(); var handlerMgr = new FileChunkHandlerManager(handlers); services.AddService(typeof(FileChunkHandlerManager), handlerMgr); }
/// <summary> /// Constructs a new writer instance. /// </summary> /// <param name="context">Must not be null. Can be reused from a read operation.</param> public FileChunkWriter(ChunkFileContext context) : base(context) { Check.IfArgumentNull(context, nameof(context)); Check.IfArgumentNull(context.Services, nameof(context.Services)); _streamNavigator = context.Services.GetService <IStreamNavigator>(); _handlerMgr = context.Services.GetService <FileChunkHandlerManager>(); _stringWriter = context.Services.GetService <IStringWriter>(); _numberWriter = context.Services.GetService <INumberWriter>(); context.Services.AddService(GetType(), this); }