I'm working with EF in a detached fashion because I'm using WCF services. I'm having trouble setting a foreign key reference when updating the entity (add works fine.)
The code -
http://pastebin.com/d4f69895dOn db.SaveChanges() - it throws the exception - "A relationship is being added or deleted from an AssociationSet 'FK_Users_CarrierId'. With cardinality constraints, a corresponding 'Users' must also be added or deleted."
Here's how I add the carrier reference:
entity.CarrierReference.EntityKey =
new EntityKey("CouponEntities.Carrier", "CarrierId", user.Carrier.Id);
How do I fix this exception? Dealing with foreign keys seems to not be so much fun in EF...
Thanks,
Justin