Example #1
0
        public Person Add(Person 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;
        }
 public void Visit(Person person)
 {
     TypeOfProfile = "Person";
 }
Example #3
0
 public void Delete(Person entity)
 {
     context.DeleteObject(entity);
 }
Example #4
0
 public Person Update(Person entity)
 {
     return entity;
 }
        private void FixupPerson(Person previousValue)
        {
            if (previousValue != null && previousValue.Transaction.Contains(this))
            {
                previousValue.Transaction.Remove(this);
            }

            if (Person != null)
            {
                if (!Person.Transaction.Contains(this))
                {
                    Person.Transaction.Add(this);
                }
                if (Person_id != Person.Id)
                {
                    Person_id = Person.Id;
                }
            }
        }