-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
294c8ec
commit 51321d1
Showing
20 changed files
with
277 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
51321d1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImplementedByAll with multiple ID columns
ImplementedByAllAttribute
enables a entity or lite reference to point to any entity in the database.Old Database Implementation
Of course you can not make a FK to every table, so traditionally it was implemented by having two columns:
RelatedID_Type
: A ForeignKey to the types tableRelatedID
: An untyped Id field.Originally this Id field was of type
int
, but once Signum Framework supported other types as primary keys (like 8 years ago) the ID fields of the ImplementedBy all changed to be of typeNVARCHAR(40)
to accomodateint
,GUID
, etc...Of course this has some performance penalty when you try to join tables due to conversions from
int
/GUID
toNVARCHAR(40)
.New Database Implementation
This change removes this
NVARCHAR(40)
column and instead adds one column for each distinct ID type in the database:The LINQ Provider/Saver/BulkInserter etc has been updated to make this change transparent in your code.
How to upgrade
The list of distinct ID type is not automatically detected by the framework, instead it has to be declared at the beginning of the Starter.Start method.
The default is
int
:If you happen to add some entity with other primary key type (
Guid
) like Southwind does:Then an exception will be thrown on
SchemaCompleted
suggesting to add a line like this one to your Starter.Start method:The
SchemaSynchronizer
has now some hard-coded rules to detect the transition of ImplementedByAll columns and create the required SQL Script, no questions asked.Enjoy!