private static void SetFakeReferenceKeyValues(object entity, EntityType entityType) { foreach (EdmProperty keyProperty in entityType.KeyProperties) { PropertyInfo clrPropertyInfo = keyProperty.GetClrPropertyInfo(); object referenceKeyValue = ModificationCommandTreeGenerator.GetFakeReferenceKeyValue(keyProperty.UnderlyingPrimitiveType.PrimitiveTypeKind); if (referenceKeyValue != null) { clrPropertyInfo.GetPropertyInfoForSet().SetValue(entity, referenceKeyValue, (object[])null); } } }