Пример #1
0
        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;
        }
Пример #2
0
 public void Delete(Address entity)
 {
     context.DeleteObject(entity);
 }
Пример #3
0
 public Address Update(Address entity)
 {
     return entity;
 }
Пример #4
0
        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;
                }
            }
        }