public Address Add(Address entity) { if (entity.Id > 0) return entity; context.Address.AddObject(entity); try { context.SaveChanges(); } catch (OptimisticConcurrencyException e) { //An optimistic concurrency violation has occurred in the data source. throw new ConcurrencyException(e.Message); } return entity; }
public void Delete(Address entity) { context.DeleteObject(entity); }
public Address Update(Address entity) { return entity; }
private void FixupAddress(Address previousValue) { if (previousValue != null && previousValue.Profile.Contains(this)) { previousValue.Profile.Remove(this); } if (Address != null) { if (!Address.Profile.Contains(this)) { Address.Profile.Add(this); } if (Address_id != Address.Id) { Address_id = Address.Id; } } }