internal virtual void Key(PropertyInfo propertyInfo, OverridableConfigurationParts? overridableConfigurationParts) { DebugCheck.NotNull(propertyInfo); if (!propertyInfo.IsValidEdmScalarProperty()) { throw Error.ModelBuilder_KeyPropertiesMustBePrimitive(propertyInfo.Name, ClrType); } if (!_isKeyConfigured && !_keyProperties.ContainsSame(propertyInfo)) { _keyProperties.Add(propertyInfo); Property(new PropertyPath(propertyInfo), overridableConfigurationParts); } }
public virtual void Key( PropertyInfo propertyInfo, OverridableConfigurationParts? overridableConfigurationParts = null) { Contract.Requires(propertyInfo != null); if (!propertyInfo.IsValidEdmScalarProperty()) { throw Error.ModelBuilder_KeyPropertiesMustBePrimitive(propertyInfo.Name, ClrType); } if (!_isKeyConfigured && // DevDiv #324763 (DbModelBuilder.Build is not idempotent): If build is called twice when keys are configured via attributes // _isKeyConfigured is not set, thus we need to check whether the key has already been included. !_keyProperties.ContainsSame(propertyInfo)) { _keyProperties.Add(propertyInfo); Property(new PropertyPath(propertyInfo), overridableConfigurationParts); } }
internal virtual void Key( PropertyInfo propertyInfo, OverridableConfigurationParts? overridableConfigurationParts, bool configuredByAttribute) { DebugCheck.NotNull(propertyInfo); if (!propertyInfo.IsValidEdmScalarProperty()) { throw Error.ModelBuilder_KeyPropertiesMustBePrimitive(propertyInfo.Name, ClrType); } if (!_isKeyConfigured && // DevDiv #324763 (DbModelBuilder.Build is not idempotent): If build is called twice when keys are configured via attributes // _isKeyConfigured is not set, thus we need to check whether the key has already been included. !_keyProperties.ContainsSame(propertyInfo) && (configuredByAttribute || !_isKeyConfiguredByAttributes)) { _isKeyConfiguredByAttributes |= configuredByAttribute; _keyProperties.Add(propertyInfo); Property(new PropertyPath(propertyInfo), overridableConfigurationParts); } }