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

Explanation of HasAnnotation in fluent configuration #13028

Closed
bugproof opened this issue Aug 16, 2018 · 2 comments
Closed

Explanation of HasAnnotation in fluent configuration #13028

bugproof opened this issue Aug 16, 2018 · 2 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@bugproof
Copy link

https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.modelbuilder.hasannotation?view=efcore-2.1

How exactly does it work? What is exactly annotation in this method's context? Is this database related or application related?

Does it mean I can add attributes like [MyAttribute] using fluent API?

@ajcvickers
Copy link
Contributor

@thorgard It's an arbitrary object attached to the model and referenced by a name. It's not a "data annotation" or a .NET attribute. It's just a way of attaching information to the model that can later be read from the model. Internally, lots of things configured on the model are stored as annotations--for example, the constraint name for an FK.

You are free to add your own annotations, but they have little value unless you implement something that also uses them, and that's not common. One place they can be useful is to flow information from model building through to Migrations--issue #10258 is about making that easier to use.

@ajcvickers ajcvickers added the closed-no-further-action The issue is closed and no further action is planned. label Aug 16, 2018
@weitzhandler
Copy link
Contributor

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants