Migrations: Preserve entity type display name in snapshot - #3810
Conversation
This also removes any semantics about a shadow entity's name. Fixes #3545
There was a problem hiding this comment.
worth putting a comment for this?
|
|
|
Hmm, I hate that this adds an annotation to virtually every entity type in the snapshot... Any better ideas @ajcvickers @AndriySvyryd @anpete @divega @rowanmiller? The root of the problem is that the default table name (and thus the key, index, and foreign key names) are based off This PR takes away the semantics and captures |
There was a problem hiding this comment.
Which is the lesser of two evils..?
|
I'm not sure I fully understand this, can we discuss in person? |
|
@bricelam This is a consequence of having shadow state entity types in the snapshot, right? In other words, the model used to create the snapshot has real entity types, but the snapshot model loads these as shadow types, which then causes a difference in behavior with regards to names. |
|
@ajcvickers Exactly. By converting CLR-backed entity types to shadow entities, we loose some information used by |
|
Could we write the table name annotation instead? |
|
@anpete Yes, but we'd also have to update constraint names to be based on that (instead of entity type name) which means when you rename a table, all the constraints touching it would also be renamed resulting in a larger diff than expected. |
|
@bricelam Could we annotate with the display name only for generic types? |
|
And possibly we should call the annotation something else |
|
@ajcvickers The existing code has a few other quarks that I don't like. For example, if I name a shadow entity |
|
@bricelam Could we have a simpler way of producing a table name from a type name string? I.e. not use DisplayName? |
|
This PR simplifies it to...
|
|
We could change |
|
We could also strip out the namespaces of the generic type arguments which would simplify the conversion: ...but this still applies semantics to |
|
Recalling. We decided to serialize |
This also removes any semantics about a shadow entity names.
Fixes #3545
@smitpatel