示例#1
0
 public virtual void Insert(T entity)
 {
     try
     {
         if (entity == null)
         {
             throw new ArgumentNullException("entity");
         }
         Entities.Add(entity);
         if (Context == null || _isDisposed)
         {
             Context = new EBusValidatorContext();
         }
         //Context.SaveChanges(); commented out call to SaveChanges as Context save changes will be
         //called with Unit of work
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 _errorMessage += string.Format("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage) + Environment.NewLine;
             }
         }
         throw new Exception(_errorMessage, dbEx);
     }
 }
示例#2
0
 public TransactionRepository(EBusValidatorContext context)
     : base(context)
 {
 }
示例#3
0
 public SmartcardRepository(EBusValidatorContext context)
     : base(context)
 {
 }
示例#4
0
 public GuardianRepository(EBusValidatorContext context)
     : base(context)
 {
 }
示例#5
0
 public GenericRepository(EBusValidatorContext context)
 {
     _isDisposed = false;
     Context     = context;
 }