private void InitComponents() { directoryBc = Site.GetService(typeof(IDirectoryBc)) as IDirectoryBc; if (directoryBc == null) { throw new ComponentNotFoundException("Missing IDirectoryBc component!"); } }
public ServiceHandler(IServiceContainer context) { fileBc = context.GetService(typeof(IFileBc)) as IFileBc; if (fileBc == null) { throw new ComponentNotFoundException("IFileBc not found"); } directoryBc = context.GetService(typeof(IDirectoryBc)) as IDirectoryBc; if (directoryBc == null) { throw new ComponentNotFoundException("IDirectoryBc not found"); } }
private static IServiceContainer InitContainer(IServiceFactory factory) { if (factory == null) { throw new ArgumentNullException("factory"); } IServiceContainer container = factory.CreateContainer(); IFileBc fileBc = factory.CreateFileComponent(); IDirectoryBc directoryBc = factory.CreateDirectoryComponent(); container.Add(fileBc, "fileComponent"); container.Add(directoryBc, "directoryComponent"); return(container); }