Closed mgroves closed 1 year ago
I would assume the reason is to put convention around the default of choosing a string to identify a description for the migration. If the description of the migration is like the title of an article in the magazine, author is... the author.
That being said, this is a fictitious example and I personally don't customize MigrationAttribute, and I've written thousands of migrations across many different types of projects. They all have the same basic architecture. But others might want something differently. I recall one person wanted a Team Name to split migrations by. I didn't think that was a great idea, but I gave my thoughts, and if the people using the framework can find a workflow with that approach that works flawlessly, then it is great for them.
I see. So this could also be done with, say, a code comment?
It's just for demonstrating what could be done. I'm trying to draw a distinction of, would you ask Microsoft why they picked a particular example discussing how to use attributes in general? https://learn.microsoft.com/en-us/dotnet/csharp/advanced-topics/reflection-and-attributes/attribute-tutorial uses Foo for a class name.
Just trying to understand what you want to achieve. If it's to settle a discussion with a coworker who copy pasted this code verbatim, then you don't need me to tell this person should "do his own homework".
I personally didn't write this example but I think for setting the version, many people use the non Author part.
If you think it should be changed, submit a pr.
Maybe what you really want to know is, how can Author be made use of outside this class? That would require customizing how the VersionInfo data is stored so that a new attribute can be tracked. Is that what you're really trying to get at?
Not trying to get at anything, other than I showed this example to a user group, someone asked me why Author was there, and it wasn't used to create the version number, so I didn't know.
Ah, sorry about that. I think we can add a note about populating VersionInfo table with more columns. For most people, that's overkill, including myself.
Added. Thanks for the good discussion.
For the example in this page: https://fluentmigrator.github.io/articles/migration/migration-attribute-custom.html?q=enforce there is an Author member:
But it doesn't seem to be used for anything other than just having an author listed in the source code.
But wouldn't that be adequately accomplished with source control? Why is Author used in this example?
Maybe that can be addressed/further explained in the text of this page of documentation?