-
Notifications
You must be signed in to change notification settings - Fork 304
Fix Serialization Side‑Effects by Using Cloned SourceDefinition Objects #3112
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -308,7 +308,7 @@ public void TestDictionaryDatabaseObjectSerializationDeserialization_WithDollarC | |||||||||||||||
|
|
||||||||||||||||
| Assert.AreEqual(deserializedDatabaseTable.SourceType, _databaseTable.SourceType); | ||||||||||||||||
| Assert.AreEqual(deserializedDatabaseTable.FullName, _databaseTable.FullName); | ||||||||||||||||
| deserializedDatabaseTable.Equals(_databaseTable); | ||||||||||||||||
| Assert.IsTrue(deserializedDatabaseTable.Equals(_databaseTable)); | ||||||||||||||||
| VerifySourceDefinitionSerializationDeserialization(deserializedDatabaseTable.SourceDefinition, _databaseTable.SourceDefinition, "$FirstName"); | ||||||||||||||||
| VerifySourceDefinitionSerializationDeserialization(deserializedDatabaseTable.TableDefinition, _databaseTable.TableDefinition, "$FirstName"); | ||||||||||||||||
| } | ||||||||||||||||
|
|
@@ -343,7 +343,7 @@ public void TestDatabaseViewSerializationDeserialization_WithDollarColumn() | |||||||||||||||
| DatabaseView deserializedDatabaseView = (DatabaseView)deserializedDict["person"]; | ||||||||||||||||
|
|
||||||||||||||||
| Assert.AreEqual(deserializedDatabaseView.SourceType, _databaseView.SourceType); | ||||||||||||||||
| deserializedDatabaseView.Equals(_databaseView); | ||||||||||||||||
| Assert.IsTrue(deserializedDatabaseView.Equals(_databaseView)); | ||||||||||||||||
| VerifySourceDefinitionSerializationDeserialization(deserializedDatabaseView.SourceDefinition, _databaseView.SourceDefinition, "$FirstName"); | ||||||||||||||||
| VerifySourceDefinitionSerializationDeserialization(deserializedDatabaseView.ViewDefinition, _databaseView.ViewDefinition, "$FirstName"); | ||||||||||||||||
| } | ||||||||||||||||
|
|
@@ -377,7 +377,7 @@ public void TestDatabaseStoredProcedureSerializationDeserialization_WithDollarCo | |||||||||||||||
| DatabaseStoredProcedure deserializedDatabaseSP = (DatabaseStoredProcedure)deserializedDict["person"]; | ||||||||||||||||
|
|
||||||||||||||||
| Assert.AreEqual(deserializedDatabaseSP.SourceType, _databaseStoredProcedure.SourceType); | ||||||||||||||||
| deserializedDatabaseSP.Equals(_databaseStoredProcedure); | ||||||||||||||||
| Assert.IsTrue(deserializedDatabaseSP.Equals(_databaseStoredProcedure)); | ||||||||||||||||
| VerifySourceDefinitionSerializationDeserialization(deserializedDatabaseSP.SourceDefinition, _databaseStoredProcedure.SourceDefinition, "$FirstName", true); | ||||||||||||||||
| VerifySourceDefinitionSerializationDeserialization(deserializedDatabaseSP.StoredProcedureDefinition, _databaseStoredProcedure.StoredProcedureDefinition, "$FirstName", true); | ||||||||||||||||
| } | ||||||||||||||||
|
|
@@ -529,7 +529,10 @@ private static void VerifyColumnDefinitionSerializationDeserialization(ColumnDef | |||||||||||||||
| Assert.AreEqual(fields, 8); | ||||||||||||||||
|
|
||||||||||||||||
| // test values | ||||||||||||||||
| expectedColumnDefinition.Equals(deserializedColumnDefinition); | ||||||||||||||||
| Assert.AreEqual(expectedColumnDefinition.DbType, deserializedColumnDefinition.DbType); | ||||||||||||||||
| Assert.AreEqual(expectedColumnDefinition.SqlDbType, deserializedColumnDefinition.SqlDbType); | ||||||||||||||||
| Assert.AreEqual(expectedColumnDefinition.IsAutoGenerated, deserializedColumnDefinition.IsAutoGenerated); | ||||||||||||||||
| Assert.AreEqual(expectedColumnDefinition.DefaultValue.ToString(), deserializedColumnDefinition.DefaultValue.ToString()); | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+532
to
536
|
||||||||||||||||
|
|
||||||||||||||||
| private static void VerifyParameterDefinitionSerializationDeserialization(ParameterDefinition expectedParameterDefinition, ParameterDefinition deserializedParameterDefinition) | ||||||||||||||||
|
|
@@ -538,7 +541,10 @@ private static void VerifyParameterDefinitionSerializationDeserialization(Parame | |||||||||||||||
| int fields = typeof(ParameterDefinition).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Length; | ||||||||||||||||
| Assert.AreEqual(fields, 9); | ||||||||||||||||
| // test values | ||||||||||||||||
| expectedParameterDefinition.Equals(deserializedParameterDefinition); | ||||||||||||||||
| Assert.AreEqual(expectedParameterDefinition.DbType, deserializedParameterDefinition.DbType); | ||||||||||||||||
| Assert.AreEqual(expectedParameterDefinition.SqlDbType, deserializedParameterDefinition.SqlDbType); | ||||||||||||||||
| Assert.AreEqual(expectedParameterDefinition.SystemType, deserializedParameterDefinition.SystemType); | ||||||||||||||||
| Assert.AreEqual(expectedParameterDefinition.ConfigDefaultValue.ToString(), deserializedParameterDefinition.ConfigDefaultValue.ToString()); | ||||||||||||||||
|
||||||||||||||||
| Assert.AreEqual(expectedParameterDefinition.ConfigDefaultValue.ToString(), deserializedParameterDefinition.ConfigDefaultValue.ToString()); | |
| Assert.AreEqual(expectedParameterDefinition.HasConfigDefault, deserializedParameterDefinition.HasConfigDefault); | |
| if (expectedParameterDefinition.HasConfigDefault) | |
| { | |
| Assert.AreEqual(expectedParameterDefinition.ConfigDefaultValue, deserializedParameterDefinition.ConfigDefaultValue); | |
| } |
Copilot
AI
Feb 6, 2026
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.
VerifyParameterDefinitionSerializationDeserialization no longer asserts several fields on ParameterDefinition (e.g., Name, Required, HasConfigDefault, Default, Description). If the goal is to validate serialization round-trips, add assertions for the remaining properties so changes to parameter serialization are detected by tests.
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.
looking at the cloning approach, it seems to be a shallow copy. this should be fine for now but for awareness should be added in notes/comments.