Example #1
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual void SetProperties(
            IReadOnlyList <Property> properties, Key principalKey, ConfigurationSource?configurationSource)
        {
            Validate(properties, principalKey, DeclaringEntityType, PrincipalEntityType);

            var oldProperties   = Properties;
            var oldPrincipalKey = PrincipalKey;

            DeclaringEntityType.OnForeignKeyUpdating(this);

            Properties   = properties;
            PrincipalKey = principalKey;

            DeclaringEntityType.OnForeignKeyUpdated(this);

            if (configurationSource != null)
            {
                UpdatePropertiesConfigurationSource(configurationSource.Value);
                UpdatePrincipalKeyConfigurationSource(configurationSource.Value);
            }

            DeclaringEntityType.Model.ConventionDispatcher.OnForeignKeyPropertiesChanged(Builder, oldProperties, oldPrincipalKey);
        }