-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Convention-based model builder support for Data Annotations #107
Comments
@smitpatel please talk to @AndriySvyryd about the details. |
I ran into another scenario where this issue causes problems. Because .MaxLengh() isn't being honored on string properties, nvarchar(MAX) fields are generated in the db. Unique constraints aren't supported on nvarchar(MAX) fields, so an error is thrown during db generation not for applying the .MaxLength() annotation, but when you apply a Unique constraint on a string property where you think you've limited the length. |
👍 [Unique]
public int MySurrogateKey { get; set; }
// here MySurrogateKey can be null as a unique value [UniqueNotNull]
public int MySurrogateKey { get; set; }
// here MySurrogateKey can not be null [UniqueAllowNull]
public int MySurrogateKey { get; set; }
// here MySurrogateKey can be null multiple times, but non-null values should be unique copy: @Tratcher, @davidfowl, @NTaylorMullen |
We should support StringLength which is a synonym of MaxLength only applicable to strings. |
+1 for |
This should be sufficient as the initial implementation. We'll file separate issues for remaining work. |
How about the ability to change column name?
|
@salarcode - |
What about |
@justdmitry In EF7 we support defining indexes using the fluent API but not an attribute, at least no yet. The IndexAttribute you are possibly referring to is something we added to the EF 6.x package at some point but never really became a standard DataAnnotation. We don't want to copy the original attribute from EF6 as is because there are a few things in it that we would like to change. Also, having it in DataAnnotations directly would likely make more sense than adding it to the EF7 package. The priority is going to be driven by customer feedback. |
I should mention though that it is highly unlikely that we will add IndexAttribute in the EF7 RTM timeframe. |
+1 for IndexAttribute |
+1 for IndexAttribute. |
I've always thought that something like
should instead be (or at least support) something like this;
Would this be considered for inclusion, or is it something an extension library should offer? |
+1 for IndexAttribute |
+1 for IndexAttribute, that was nice feature. Of course in parallel with "fluent API" implementation. |
+1 for IndexAttribute |
3 similar comments
+1 for IndexAttribute |
+1 for IndexAttribute |
+1 for IndexAttribute |
+1 for IndexAttribute |
+1 for IndexAttribute. |
This issue is closed and will not be considered for planning purposes. Please direct all |
We should try to support at least the very basic ones, e.g. KeyAttribute for alpha, provided that the DataAnnotations build is ready for K.
Attributes to be implemented:
Relationship
Not supported yet
The text was updated successfully, but these errors were encountered: