private void InitLiteDb(string dbFile) { Database = new LiteDatabase(dbFile); // Mappings var mapper = BsonMapper.Global; mapper.Entity <UserAvatar>() .Id(x => x.Jid); mapper.Entity <Avatar>() .Id(x => x.ImageHash); // Get a collections (or create, if doesn't exist) Avatars = Database.GetCollection <Avatar>(nameof(Avatars)); Contacts = Database.GetCollection <Contact>(nameof(Contacts)); Accounts = Database.GetCollection <Account>(nameof(Accounts)); Capabilities = Database.GetCollection <Capability>(nameof(Capabilities)); UserAvatars = Database.GetCollection <UserAvatar>(nameof(UserAvatars)); //UserAvatars.EnsureIndex(u => u.Jid, true); Contacts.EnsureIndex(c => c.AccountId); Contacts.EnsureIndex(c => c.Jid); Capabilities.EnsureIndex(c => c.Version, true); Accounts.EnsureIndex(a => a.Jid, true); }