Skip to content

Remove obsolete serialization - #476

Merged
alex-kulakov merged 99 commits into
masterfrom
master-serialization-change
Sep 18, 2026
Merged

alex-kulakov merged 99 commits into
masterfrom
master-serialization-change

Conversation

@alex-kulakov

@alex-kulakov alex-kulakov commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Destroyed binary serialization usage - no type implements ISerializable nor IDeserializationCallback, all the types which are not supposed to be serialized lost their [Serializable] attribute.

In particular, Persistent types (Entity, EntitySet<T>, Structure) no longer serializable via obsolete binary serialization. Current recommended approach in dotnet is to create DTOs to manage what exactly serialized and how deep serialization should be, which prevents accidental fetching of the whole graph of data from database.

SerializableExpressions API was moved out main library to extension Xtensive.Orm.SerializableExpressions. They remain being able to be serialized and support JsonSerializer and DataContract serialization.

Operations API was moved out main library to extension Xtensive.Orm.Operations, except for abstractions needed to exist inside main library, so this improved speed o entity operations in main scenario when no operation registered. Operations can be serialized by JsonSerializer, also added JsonConverters and an extension to add them to JsonSerializerOptions.Converters collections.

Removes serialization tests or parts of tests that performed such

Other changes that appeared during main task

  • TupleUpdater is obsolete] because it is not in use so will be removed.
  • IntegrityException is obsolete
  • ReferenceInfo, SyncAction structs became readonly, properties replaced with readonly fields
  • ColumnInfoRef properties replaced with readonly fields
  • PrefetchProcessor removed
  • Improve domain model validation speed by just adding exceptions to ExceptionAggregator, instead of using throwing of them
  • Added AdvancedConveters for types like DateOnly, TimeOnly, DateTimeOffset and byte[] to other types and from other types, adding conversion to string fixed TupleFormatExtensions.Format(this Tuple) and TupleFormatExtensions.Parse(this TupleDescriptor, string) extension methods, which could not work for some of real-life tuples from actual entities. Tests for conversions and tuple operations added. This was required for tuple serialization.
  • AdvancedConverters tests improved, now most of them have unified structure with superset of tests, one for each possible target type; possible target types for converter declared in each test class; if conversion is impossible test is ignored.
  • applied formatting rules and/or resolved some of ide warnings

Base constructor is marked as obsolete as well as ours, NET 10 removes
them completely
- No ISerializable based serialization
- Added support for serialization via DataContract and JsonSerializer
- Added tests and fixed some issues (some of fixes were ported from main branch)
- Delete test (the case is already covered in another test)
- Cloning via BinaryFormatter is marked as obsolete until in use
- Added Cloning via DataContractSerializer, DataContractJsonSerializer
  and JsonSerializer
- added domains of types to use them for DataContract-based serialization
- Xtensive.Orm contains only API basis and usage to create and register
  operations.
- All the real operations are outside main library, it made creation,
  modification, deletion of Entities faster when no registration needed,
  as well as EntitySet.Add/Remove/Clear operations
Before that, EntityFieldSet operation grabbed persistent object, which
exists in session context, so it is not good.
Now there is NestedOperations collection for all nested fields that persistent
structure suppose to change on Field change
and also some of tests of serialization
- Binary serialization is almost eliminated in .NET, there is no point of them
to be serializable
- created base type with separated tests for each target type (get from CombinedTest)
- main tests were moved to new generic base type
- make converstion based testing, if there is a conversion test runs, otherwise ignored
- added DateOnly/TimeOnly conversion test
- info messages replaced to error messages in log in case of exceptions
- add category for tests
- use log only if it is enabled
- json converters that can serialize
- Extension to add the converters (domain required including)
# Conflicts:
#	ChangeLog/7.3.0-Beta-1-dev.txt
#	Extensions/Xtensive.Orm.Operations/Operations/EntitySetOperation.cs
#	Extensions/Xtensive.Orm.SerializableExpressions/Internals/SerializableExpressionToExpressionConverter.cs
#	Orm.sln
#	Orm/Xtensive.Orm.Tests.Core/Linq/SerializableExpressionsTest.cs
#	Orm/Xtensive.Orm.Tests.Core/Tuples/TupleDescriptorTest.cs
#	Orm/Xtensive.Orm.Tests.Framework/Internals/InstanceGeneratorBase.cs
#	Orm/Xtensive.Orm.Tests/Interfaces/KeyStructureConflictTest.cs
#	Orm/Xtensive.Orm.Tests/Interfaces/TypeIdModeConflictTest.cs
#	Orm/Xtensive.Orm.Tests/Interfaces/UnusedTypeRemovalTest.cs
#	Orm/Xtensive.Orm.Tests/Issues/Issue0262_StructureAssignment.cs
#	Orm/Xtensive.Orm.Tests/Issues/IssueJira0197_ExtendedErrorInformation.cs
#	Orm/Xtensive.Orm.Tests/Linq/CustomExpressionCompilers.cs
#	Orm/Xtensive.Orm/Arithmetic/ArithmeticBase.cs
#	Orm/Xtensive.Orm/Collections/Deque.cs
#	Orm/Xtensive.Orm/Collections/ExtensionCollection.cs
#	Orm/Xtensive.Orm/Collections/FixedList3.cs
#	Orm/Xtensive.Orm/Collections/Graphs/Edge.cs
#	Orm/Xtensive.Orm/Collections/TypeRegistration.cs
#	Orm/Xtensive.Orm/Collections/TypeRegistrationProcessorBase.cs
#	Orm/Xtensive.Orm/Collections/TypeRegistry.cs
#	Orm/Xtensive.Orm/Conversion/AdvancedConverterBase.cs
#	Orm/Xtensive.Orm/Conversion/Internals/ConvertingEnumerator.cs
#	Orm/Xtensive.Orm/Linq/Internals/ExpressionComparer.cs
#	Orm/Xtensive.Orm/Linq/SerializableExpressions/Internals/ExpressionToSerializableExpressionConverter.cs
#	Orm/Xtensive.Orm/Linq/SerializableExpressions/Internals/ReflectionExtensions.cs
#	Orm/Xtensive.Orm/Modelling/Actions/PropertyChangeAction.cs
#	Orm/Xtensive.Orm/Modelling/Actions/RemoveNodeAction.cs
#	Orm/Xtensive.Orm/Modelling/Comparison/Hints/CopyDataHint.cs
#	Orm/Xtensive.Orm/Modelling/Comparison/Hints/UpdateDataHint.cs
#	Orm/Xtensive.Orm/Modelling/NodeCollection.cs
#	Orm/Xtensive.Orm/Orm/Configuration/NameMappingCollection.cs
#	Orm/Xtensive.Orm/Orm/EntitySetBase.cs
#	Orm/Xtensive.Orm/Orm/Internals/EntitySetTypeState.cs
#	Orm/Xtensive.Orm/Orm/Internals/Prefetch/ReferencedEntityContainer.cs
#	Orm/Xtensive.Orm/Orm/Model/TypeDiscriminatorMap.cs
#	Orm/Xtensive.Orm/Orm/Operations/KeySetOperation.cs
#	Orm/Xtensive.Orm/Orm/Rse/AggregateColumn.cs
#	Orm/Xtensive.Orm/Orm/Rse/CalculatedColumn.cs
#	Orm/Xtensive.Orm/Orm/Rse/MappedColumn.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/AggregateProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/AliasProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/CalculateProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/ExceptProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/FilterProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/IncludeProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/IntersectProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/JoinProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/OrderProviderBase.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/PredicateJoinProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/RawProvider.cs
#	Orm/Xtensive.Orm/Orm/Rse/Providers/Provider.cs
#	Orm/Xtensive.Orm/Orm/Rse/SystemColumn.cs
#	Orm/Xtensive.Orm/Orm/Serialization/SerializationContext.cs
#	Orm/Xtensive.Orm/Orm/Upgrade/Model/PrimaryIndexInfo.cs
#	Orm/Xtensive.Orm/Orm/Upgrade/Model/SecondaryIndexInfo.cs
#	Orm/Xtensive.Orm/Orm/Upgrade/Model/StorageFullTextIndexInfo.cs
#	Orm/Xtensive.Orm/Sorting/Node.cs
#	Orm/Xtensive.Orm/Sql/Ddl/SqlAlterSequence.cs
#	Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlCase.cs
#	Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlCursor.cs
#	Orm/Xtensive.Orm/Sql/Dml/Expressions/SqlDefaultValue.cs
#	Orm/Xtensive.Orm/Sql/Model/Sequence.cs
#	Orm/Xtensive.Orm/Tuples/Transform/CombineTransform.cs
#	Orm/Xtensive.Orm/Tuples/Transform/Internals/MapTransformTuple.cs
#	Orm/Xtensive.Orm/Tuples/Transform/Internals/MapTransformTuple1.cs
#	Orm/Xtensive.Orm/Tuples/Transform/Internals/MapTransformTuple3.cs
#	Orm/Xtensive.Orm/Tuples/Transform/Internals/ReadOnlyTransformTuple.cs
#	Orm/Xtensive.Orm/Tuples/Transform/MapTransform.cs
#	Orm/Xtensive.Orm/Tuples/Transform/ReadOnlyTransform.cs
#	Orm/Xtensive.Orm/Tuples/Transform/TransformedTuple.cs
#	Orm/Xtensive.Orm/Tuples/Transform/TransformedTuple{TTupleTransform}.cs
#	Orm/Xtensive.Orm/Tuples/Transform/TupleTransformBase.cs
#	Orm/Xtensive.Orm/Tuples/Transform/WrappingTransformTupleBase.cs
#	Orm/Xtensive.Orm/Tuples/TupleDescriptor.cs
new items + typo fixed
@alex-kulakov
alex-kulakov merged commit 32ad383 into master Sep 18, 2026
26 of 34 checks passed
@alex-kulakov
alex-kulakov deleted the master-serialization-change branch September 18, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant