You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
have you tried IOC-ing the IDatabaseVersionService? It's a public interface, and it implements the GetLatestDatabaseVersion method which the project itself uses to determine the version. Add the following two parameters to your controller constructor:
public MyControllerConstructor(IMongoDatabase db, IDatabaseVersionService versionService, ... other constructor parameters here)
Then your controller method to get the version would look something like this:
public IActionResult GetVersion()
{
DocumentVersion dbVersion = versionService.GetLatestDatabaseVersion(db);
// now do something with it
}
The IDatabaseVersionService gets registered when calling AddMigrations, and if you follow the .net Core setup as per the readme, you also have the IMongoDatabase so you should be good to go.
Hi, I want to get the version of the database in a status controller in netcore. How can I find out in what version is the database?
The text was updated successfully, but these errors were encountered: