src/Shared/EntityFramework/ModelConfiguration/Configuration/Properties/Primitive/PrimitivePropertyConfiguration.cs
// <summary>Gets a value that indicates whether the provided model is compatible with the current model provider.</summary>
// <returns>true if the provided model is compatible with the current model provider; otherwise, false.</returns>
// <param name="propertyExpression">The original property expression that specifies the member and instance.</param>
// <param name="other">The property to compare.</param>
// <param name="errorMessage">The error message.</param>
// <typeparam name="TProperty">The type of the property.</typeparam>
// <typeparam name="TConfiguration">The type of the configuration to look for.</typeparam>
Gets a value that indicates whether the provided model is compatible with the current model provider.
Gets a value that indicates whether the provided model is compatible with the current model provider .
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
        [SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
        [SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", MessageId = "2#")]
        protected bool IsCompatible<TProperty, TConfiguration>(
            Expression<Func<TConfiguration, TProperty?>> propertyExpression, TConfiguration other, ref string errorMessage)
            where TProperty : struct
            where TConfiguration : PrimitivePropertyConfiguration
        {
            Check.NotNull(propertyExpression, "propertyExpression");
            Check.NotNull(other, "other");
            var propertyInfo = propertyExpression.GetSimplePropertyAccess().Single();
            var thisValue = (TProperty?)propertyInfo.GetValue(this, null);
            var otherValue = (TProperty?)propertyInfo.GetValue(other, null);
            if (IsCompatible(thisValue, otherValue))
            {
                return true;
            }
            errorMessage += Environment.NewLine + "\t" +
                            Strings.ConflictingConfigurationValue(
                                propertyInfo.Name, thisValue, propertyInfo.Name, otherValue);
            return false;
        }
[ SuppressMessage ( " " , " " ) ] [ SuppressMessage ( " " , " " ) ] [ SuppressMessage ( " " , " " , MessageId = " " ) ] protected bool IsCompatible < TProperty , TConfiguration > ( Expression < Func < TConfiguration , TProperty ? > > propertyExpression , TConfiguration other , ref string errorMessage ) where TProperty : struct where TConfiguration : PrimitivePropertyConfiguration { Check . NotNull ( propertyExpression , " " ) ; Check . NotNull ( other , " " ) ; var propertyInfo = propertyExpression . GetSimplePropertyAccess ( ) . Single ( ) ; var thisValue = ( TProperty ? ) propertyInfo . GetValue ( this , null ) ; var otherValue = ( TProperty ? ) propertyInfo . GetValue ( other , null ) ; if ( IsCompatible ( thisValue , otherValue ) ) { return true ; } errorMessage += Environment . NewLine + " \t " + Strings . ConflictingConfigurationValue ( propertyInfo . Name , thisValue , propertyInfo . Name , otherValue ) ; return false ; }
Gets a value that indicates whether the provided model is compatible with the current model provider.
Gets a value that indicates whether the provided model is compatible with the current model provider .
true if the provided model is compatible with the current model provider; otherwise, false.
true if the provided model is compatible with the current model provider ; otherwise false .
propertyExpression
Expression<Func<TConfiguration, TProperty?>>
The original property expression that specifies the member and instance.
The original property expression that specifies the member and instance .
other
TConfiguration
The property to compare.
The property to compare .
string
ref
errorMessage
The error message.
The error message .
typeparam
The type of the property.
The type of the property .
typeparam
The type of the configuration to look for.
The type of the configuration to look for .