Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Objects / DataClasses / RelationshipFixer.cs
blob40b72aed27ded68f1d57b60efc9120573a524dd2
1 //---------------------------------------------------------------------
2 // <copyright file="RelationshipFixer.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 //
6 // @owner Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
9 using System.Data.Metadata.Edm;
11 namespace System.Data.Objects.DataClasses
13 [Serializable]
14 internal class RelationshipFixer<TSourceEntity, TTargetEntity> : IRelationshipFixer
15 where TSourceEntity : class
16 where TTargetEntity : class
18 // The following fields are serialized. Adding or removing a serialized field is considered
19 // a breaking change. This includes changing the field type or field name of existing
20 // serialized fields. If you need to make this kind of change, it may be possible, but it
21 // will require some custom serialization/deserialization code.
22 RelationshipMultiplicity _sourceRoleMultiplicity;
23 RelationshipMultiplicity _targetRoleMultiplicity;
25 internal RelationshipFixer(RelationshipMultiplicity sourceRoleMultiplicity, RelationshipMultiplicity targetRoleMultiplicity)
27 _sourceRoleMultiplicity = sourceRoleMultiplicity;
28 _targetRoleMultiplicity = targetRoleMultiplicity;
31 /// <summary>
32 /// Used during relationship fixup when the source end of the relationship is not
33 /// yet in the relationships list, and needs to be created
34 /// </summary>
35 /// <param name="navigation">RelationshipNavigation to be set on new RelatedEnd</param>
36 /// <param name="relationshipManager">RelationshipManager to use for creating the new end</param>
37 /// <returns>Reference to the new collection or reference on the other end of the relationship</returns>
38 RelatedEnd IRelationshipFixer.CreateSourceEnd(RelationshipNavigation navigation, RelationshipManager relationshipManager)
40 return relationshipManager.CreateRelatedEnd<TTargetEntity, TSourceEntity>(navigation, _targetRoleMultiplicity, _sourceRoleMultiplicity, /*existingRelatedEnd*/ null);