private static void LoadCollections(Table table, CFStorage storage) { for (var i = 0; i < table.Data.NumCollections; i++) { var collectionName = $"Collection{i}"; storage.TryGetStream(collectionName, out var collectionStream); if (collectionStream == null) { Logger.Warn("Could not find stream {0}, skipping.", collectionName); continue; } using (var stream = new MemoryStream(collectionStream.GetData())) using (var reader = new BinaryReader(stream)) { var collection = new Collection.Collection(reader, collectionName); table.Collections[collection.Name.ToLower()] = collection; } } }
public async Task<IContext> CreateContextAsync(InternalCollectionServer server, string user, string password) { try { var ctx = new Collection.Collection(GetConnectionString(server, user, password)); // Force immediate connection to validate settings await ctx.Database.Connection.OpenAsync(); return new CollectionContext( Kernel, ctx ); } catch (Exception ex) { // TODO Log return null; } }