コード例 #1
0
ファイル: Repository.cs プロジェクト: EnvyIT/apollo
 public async Task ValidateUniqueId <T>(IBaseDao <T> dao, long id) where T : BaseEntity <T>
 {
     if (await dao.ExistByIdAsync(id))
     {
         var duplicateEntryException = new DuplicateEntryException(id, "Entity already exists!");
         Logger.Error(duplicateEntryException, "{type} with {id} already exists!", typeof(T), id);
         throw duplicateEntryException;
     }
 }
コード例 #2
0
ファイル: Repository.cs プロジェクト: EnvyIT/apollo
 public async Task ValidateId <T>(IBaseDao <T> dao, long id) where T : BaseEntity <T>
 {
     if (!await dao.ExistByIdAsync(id))
     {
         var invalidEntityIdException = new InvalidEntityIdException(id, "Entity with this id does not exist!");
         Logger.Error(invalidEntityIdException, "{type} with {id} does not exist!", typeof(T), id);
         throw invalidEntityIdException;
     }
 }