Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VersionTableMetadata info is out of date and inaccurate #69

Open
AppFzx opened this issue Jan 3, 2024 · 1 comment
Open

VersionTableMetadata info is out of date and inaccurate #69

AppFzx opened this issue Jan 3, 2024 · 1 comment

Comments

@AppFzx
Copy link

AppFzx commented Jan 3, 2024

https://github.com/fluentmigrator/documentation/blob/master/articles/version-table-metadata.md

Example leaves off ApplicationContext property of IVersionTableMetaData. Worse yet, the property is marked Obsolete so it's quite unclear what should happen here. A cryptic error while attempting to implement says use DI instead but DI of what? Using .Services.AddSingleton<IConventionSet>(new DefaultConventionSet(defaultSchemaName: "myschema", workingDirectory: null)) with Sql Server doesn't set the schema for version table to myschema, instead defaultSchemaName attempts to set the database!

This page needs an example that works. I tried digging through the code to make a PR and fix but it's unclear what the developer was attempting so it's hard to make any meaningful fix.

@jzabroski
Copy link
Contributor

jzabroski commented Feb 19, 2024

"Use DI" means:

  • Set-up your own in-process runner where you register dependencies, rather than using dotnet-fm CLI tool or the legacy CLI, etc.
  • In the in-process runner, you can add constructors to your Migrations and have those migrations take an IApplicationContext dependency that can be whatever you want - the type does not even need to be called IApplicationContext.

The reason Application Context is obsolete is that it doesn't make sense to have it as a property when you could have a strongly typed thing you inject instead. The Context is typically dynamic/external resource, like an IConfiguationService. Additional things that are not Saga-like appplication context state that you might want to inject include your database access layer / library. For examples, NHibernate, EFCore, Dapper, RepoDB.

What problem are you trying to solve?

Using .Services.AddSingleton<IConventionSet>(new DefaultConventionSet(defaultSchemaName: "myschema", workingDirectory: null)) with Sql Server doesn't set the schema for version table to myschema, instead defaultSchemaName attempts to set the database!

I have not looked into this claim, this is a documentation repo, not the code repo. Did you look at how FluentMigrator.DotNet.Cli registers convention sets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants