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

Mapping attribute for IsUnicode #19794

Closed
IanKemp opened this issue Feb 4, 2020 · 5 comments
Closed

Mapping attribute for IsUnicode #19794

IanKemp opened this issue Feb 4, 2020 · 5 comments
Assignees
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution customer-reported type-enhancement
Milestone

Comments

@IanKemp
Copy link

IanKemp commented Feb 4, 2020

What problem are you trying to solve?

We prefer to configure our entities via properties on the entities themselves, as opposed to using the fluent syntax, because we've found it makes the code more readable. However, because not every method on PropertyBuilder has an associated attribute (e.g. IsUnicode), it's not possible to use this approach - so we either have to use a half-half approach, or go full fluent; neither of which are desirable.

Describe the solution you'd like

Add attributes that mirror all available methods exposed by PropertyBuilder and result in the same behaviour.

This would have the additional benefit that EF would no longer have to rely on (mis)-using the attributes in the System.Data.DataAnnotations namespace, which are rather... overloaded at this point. That would make it easier for people to transition between fluent syntax and attributes, without needing an entire article to inform users how to map between both ways.

@ajcvickers
Copy link
Contributor

Duplicate of #10864

@ajcvickers ajcvickers marked this as a duplicate of #10864 Feb 4, 2020
@ajcvickers ajcvickers reopened this Jun 22, 2020
@ajcvickers ajcvickers changed the title Add attributes for parity with PropertyBuilder fluent methods Mapping attribute for IsUnicode Jun 22, 2020
@ajcvickers ajcvickers added this to the Backlog milestone Jun 22, 2020
@ajcvickers ajcvickers added good first issue This issue should be relatively straightforward to fix. type-enhancement area-model-building and removed closed-duplicate labels Jun 22, 2020
This was referenced Sep 11, 2020
@smitpatel
Copy link
Contributor

Design questions for @dotnet/efteam

  • Unicode attribute can be specified on any property/field/parameter. Do we need parameter support at present? We don't recognize it anywhere.
  • The XML docs refers that it can be set on string properties only. Should it be string equivalent on server side? e.g. JSON converted to string using value converter, can/should user specify IsUnicode for it? In annotation? In Fluent API?
  • In scaffolding do we print out Unicode if the value is going to be default value for strings (true).
    Unrelated to UnicodeAttribute.
  • Do we want ordering of annotations printed on entity type/properties in scaffolded code?

@smitpatel smitpatel self-assigned this Oct 16, 2020
@smitpatel
Copy link
Contributor

  • Specified on property. Field if convention pick it up by default once the field is mapped. Parameter support is deferred till we need it.
  • XML docs should be consistent with IsUnicode fluent API.
  • Scaffolding should not print attribute if default value
  • Keep current ordering.

@smitpatel smitpatel added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution labels Oct 27, 2020
@smitpatel smitpatel modified the milestones: Backlog, 6.0.0 Oct 27, 2020
@smitpatel
Copy link
Contributor

smitpatel commented Oct 27, 2020

Fixed in #22514

@IanKemp
Copy link
Author

IanKemp commented Oct 27, 2020

Thanks guys!

@ajcvickers ajcvickers removed the good first issue This issue should be relatively straightforward to fix. label Oct 29, 2020
@ajcvickers ajcvickers modified the milestones: 6.0.0, 6.0.0-preview1 Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution customer-reported type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants