public IKeyValueStorage CreateKeyValueStorage(StorageConnectionString connectionString) { if (connectionString.Prefix == "disk") { connectionString.GetRequired("path", true, out string path); return(new CsvFileKeyValueStorage(new DirectoryInfo(path))); } return(null); }
public IBlobStorage CreateBlobStorage(StorageConnectionString connectionString) { if (connectionString.Prefix == "disk") { connectionString.GetRequired("path", true, out string path); return(new DiskDirectoryBlobStorage(new DirectoryInfo(path))); } if (connectionString.Prefix == "inmemory") { return(new InMemoryBlobStorage()); } return(null); }
public static IBlobStorage CreateBlobStorage(string connectionString) { var pcs = new StorageConnectionString(connectionString); IBlobStorage instance = Factories .Select(f => f.CreateBlobStorage(pcs)) .Where(b => b != null) .FirstOrDefault(); if (instance == null) { throw new ArgumentException("could not create any implementation based on the passed connection string, did you register required external module?", nameof(connectionString)); } return(instance); }
public IMessenger CreateMessenger(StorageConnectionString connectionString) { if (connectionString.Prefix == "inmemory") { connectionString.GetRequired("name", true, out string name); return(InMemoryMessenger.CreateOrGet(name)); } if (connectionString.Prefix == "disk") { connectionString.GetRequired("path", true, out string path); return(new LocalDiskMessenger(path)); } return(null); }
private static TInstance Create <TInstance>(string connectionString, Func <IConnectionFactory, StorageConnectionString, TInstance> createAction) { if (connectionString == null) { throw new ArgumentNullException(nameof(connectionString)); } var pcs = new StorageConnectionString(connectionString); TInstance instance = Factories .Select(f => createAction(f, pcs)) .FirstOrDefault(b => b != null); if (instance == null) { throw new ArgumentException( $"could not create any implementation based on the passed connection string (prefix: {pcs.Prefix}), did you register required external module?", nameof(connectionString)); } return(instance); }
public IMessageReceiver CreateMessageReceiver(StorageConnectionString connectionString) { return(null); }