예제 #1
0
        public Profile Add(Profile entity)
        {
            if (entity.Id > 0) return entity;
            context.Profile.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 Visit(Profile profile)
 {
     profile.Accept(this);
 }
예제 #3
0
 public Profile Update(Profile entity)
 {
     return entity;
 }
예제 #4
0
 public void Delete(Profile entity)
 {
     context.DeleteObject(entity);
 }
예제 #5
0
        private void FixupProfile(Profile previousValue)
        {
            if (previousValue != null && previousValue.Withdraw.Contains(this))
            {
                previousValue.Withdraw.Remove(this);
            }

            if (Profile != null)
            {
                if (!Profile.Withdraw.Contains(this))
                {
                    Profile.Withdraw.Add(this);
                }
                if (Profile_id != Profile.Id)
                {
                    Profile_id = Profile.Id;
                }
            }
        }