public virtual void Update(T entity)
 {
     try
     {
         if (entity == null)
         {
             throw new ArgumentNullException("entity");
         }
         if (Context == null || _isDisposed)
         {
             Context = new ContactManagementApplicationContext();
         }
         SetEntryModified(entity);
     }
     catch (Exception ex)
     {
     }
 }
 public void Delete(T entity)
 {
     try
     {
         if (entity == null)
         {
             throw new ArgumentNullException("entity");
         }
         if (Context == null || _isDisposed)
         {
             Context = new ContactManagementApplicationContext();
         }
         Entities.Remove(entity);
     }
     catch
     {
     }
 }
 public void Insert(T entity)
 {
     try
     {
         if (entity == null)
         {
             throw new ArgumentNullException("entity");
         }
         Entities.Add(entity);
         Context.SaveChanges(); // need to delete when will add UOF
         if (Context == null || _isDisposed)
         {
             Context = new ContactManagementApplicationContext();
         }
     }
     catch (Exception ex)
     {
         throw new Exception();
     }
 }
Example #4
0
 public ContactRepository(ContactManagementApplicationContext context) : base(context)
 {
 }
        //public GenericRepository(IUnitOfWork<ContactManagementApplicationContext> unitOfWork)
        //        : this(unitOfWork.context)
        //{

        //}

        public GenericRepository(ContactManagementApplicationContext context)
        {
            _isDisposed = false;
            Context     = context;
        }
 public RegistrationRepository(ContactManagementApplicationContext context) : base(context)
 {
 }