|
@@ -11,6 +11,10 @@ public class Database : IDatabase
|
|
|
|
|
|
|
|
public ILiteCollection<UserProfile> Users { get; }
|
|
public ILiteCollection<UserProfile> Users { get; }
|
|
|
|
|
|
|
|
|
|
+ public ILiteCollection<Event> Events { get; }
|
|
|
|
|
+
|
|
|
|
|
+ public ILiteCollection<Registration> Registrations { get; }
|
|
|
|
|
+
|
|
|
public Database(IPersistenceOptions persistenceOptions)
|
|
public Database(IPersistenceOptions persistenceOptions)
|
|
|
{
|
|
{
|
|
|
_db = new LiteDatabase(persistenceOptions.DataFilePath);
|
|
_db = new LiteDatabase(persistenceOptions.DataFilePath);
|
|
@@ -22,5 +26,14 @@ public class Database : IDatabase
|
|
|
|
|
|
|
|
Users = _db.GetCollection<UserProfile>("users");
|
|
Users = _db.GetCollection<UserProfile>("users");
|
|
|
Users.EnsureIndex(u => u.UserId);
|
|
Users.EnsureIndex(u => u.UserId);
|
|
|
|
|
+
|
|
|
|
|
+ Events = _db.GetCollection<Event>("events")
|
|
|
|
|
+ .Include(e => e.Owner);
|
|
|
|
|
+ Events.EnsureIndex(e => e.Owner);
|
|
|
|
|
+ Events.EnsureIndex(e => e.Title);
|
|
|
|
|
+
|
|
|
|
|
+ Registrations = _db.GetCollection<Registration>("registrations");
|
|
|
|
|
+ Registrations.EnsureIndex(r => r.Owner);
|
|
|
|
|
+ Registrations.EnsureIndex(r => r.Event);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|