1- // Copyright (C) 2003-2010 Xtensive LLC.
2- // All rights reserved .
3- // For conditions of distribution and use, see license .
1+ // Copyright (C) 2009-2020 Xtensive LLC.
2+ // This code is distributed under MIT license terms .
3+ // See the License.txt file in the project root for more information .
44// Created by: Alex Yakunin
55// Created: 2009.04.07
66
@@ -122,20 +122,23 @@ public ReadOnlyList<NodeAction> GetUpgradeSequence(Difference difference, HintSe
122122 {
123123 ArgumentValidator . EnsureArgumentNotNull ( hints , "hints" ) ;
124124 ArgumentValidator . EnsureArgumentNotNull ( comparer , "comparer" ) ;
125- if ( difference == null )
125+ if ( difference == null ) {
126126 return new ReadOnlyList < NodeAction > ( Enumerable . Empty < NodeAction > ( ) . ToList ( ) ) ;
127+ }
127128
128129 TemporaryRenames = new Dictionary < string , Node > ( StringComparer . OrdinalIgnoreCase ) ;
129130 SourceModel = ( IModel ) difference . Source ;
130131 TargetModel = ( IModel ) difference . Target ;
131132 Hints = hints ?? new HintSet ( SourceModel , TargetModel ) ;
132133 Comparer = comparer ;
133- if ( Hints . SourceModel != SourceModel )
134+ if ( Hints . SourceModel != SourceModel ) {
134135 throw new ArgumentOutOfRangeException ( "hints.SourceModel" ) ;
135- if ( Hints . TargetModel != TargetModel )
136+ }
137+ if ( Hints . TargetModel != TargetModel ) {
136138 throw new ArgumentOutOfRangeException ( "hints.TargetModel" ) ;
139+ }
137140
138- CurrentModel = ( IModel ) SourceModel . Clone ( null , SourceModel . Name ) ;
141+ CurrentModel = ( IModel ) SourceModel . Clone ( null , SourceModel . Name ) ;
139142 Difference = difference ;
140143 var previous = currentAsync . Value ;
141144 currentAsync . Value = this ;
@@ -152,15 +155,17 @@ public ReadOnlyList<NodeAction> GetUpgradeSequence(Difference difference, HintSe
152155 ProcessStage ( UpgradeStage . Cleanup , actions ) ;
153156
154157 var validationHints = new HintSet ( CurrentModel , TargetModel ) ;
155- Hints . OfType < IgnoreHint > ( ) . ForEach ( validationHints . Add ) ;
158+ Hints . OfType < IgnoreHint > ( )
159+ . Where ( h => CurrentModel . Resolve ( h . Path , false ) != null && SourceModel . Resolve ( h . Path , false ) != null )
160+ . ForEach ( validationHints . Add ) ;
156161 var diff = comparer . Compare ( CurrentModel , TargetModel , validationHints ) ;
157- if ( diff != null ) {
162+ if ( diff != null ) {
158163 CoreLog . InfoRegion ( Strings . LogAutomaticUpgradeSequenceValidation ) ;
159164 CoreLog . Info ( Strings . LogValidationFailed ) ;
160165 CoreLog . Info ( Strings . LogItemFormat , Strings . Difference ) ;
161166 CoreLog . Info ( "{0}" , diff ) ;
162- CoreLog . Info ( Strings . LogItemFormat + "\r \n {1}" , Strings . UpgradeSequence ,
163- new ActionSequence ( ) { actions } ) ;
167+ CoreLog . Info ( Strings . LogItemFormat + "\r \n {1}" , Strings . UpgradeSequence ,
168+ new ActionSequence ( ) { actions } ) ;
164169 CoreLog . Info ( Strings . LogItemFormat , Strings . ExpectedTargetModel ) ;
165170 TargetModel . Dump ( ) ;
166171 CoreLog . Info ( Strings . LogItemFormat , Strings . ActualTargetModel ) ;
0 commit comments