Skip to content

Commit

Permalink
Fixed styling
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianKuesters committed Sep 5, 2022
1 parent 4890698 commit eb37ce9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Wemogy.Infrastructure.Database.Core.ValueObjects;

namespace Wemogy.Infrastructure.Database.Core.Abstractions
namespace Wemogy.Infrastructure.Database.Core.Abstractions;

public partial interface IDatabaseRepository<TEntity, in TPartitionKey, in TId>
where TEntity : IEntityBase<TId>
where TPartitionKey : IEquatable<TPartitionKey>
where TId : IEquatable<TId>
{
public partial interface IDatabaseRepository<TEntity, in TPartitionKey, in TId>
where TEntity : IEntityBase<TId>
where TPartitionKey : IEquatable<TPartitionKey>
where TId : IEquatable<TId>
{
Task<bool> ExistsAsync(TId id, TPartitionKey partitionKey, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(TId id, TPartitionKey partitionKey, CancellationToken cancellationToken = default);

Task<bool> ExistsAsync(TId id, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(TId id, CancellationToken cancellationToken = default);

Task<bool> ExistsAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default);
}
Task<bool> ExistsAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,64 @@
using System.Threading.Tasks;
using Wemogy.Infrastructure.Database.Core.ValueObjects;

namespace Wemogy.Infrastructure.Database.Core.Abstractions
namespace Wemogy.Infrastructure.Database.Core.Abstractions;

public partial interface IDatabaseRepository<TEntity, in TPartitionKey, in TId> : IDatabaseRepository
where TEntity : IEntityBase<TId>
where TPartitionKey : IEquatable<TPartitionKey>
where TId : IEquatable<TId>
{
public partial interface IDatabaseRepository<TEntity, in TPartitionKey, in TId> : IDatabaseRepository
where TEntity : IEntityBase<TId>
where TPartitionKey : IEquatable<TPartitionKey>
where TId : IEquatable<TId>
{
SoftDeleteState<TEntity> SoftDelete { get; }
SoftDeleteState<TEntity> SoftDelete { get; }

Task<TEntity> GetAsync(TId id, TPartitionKey partitionKey, CancellationToken cancellationToken = default);
Task<TEntity> GetAsync(TId id, TPartitionKey partitionKey, CancellationToken cancellationToken = default);

Task<TEntity> GetAsync(TId id, CancellationToken cancellationToken = default);
Task<TEntity> GetAsync(TId id, CancellationToken cancellationToken = default);

Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default);
Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default);

Task<List<TEntity>> GetAllAsync(CancellationToken cancellationToken = default);
Task<List<TEntity>> GetAllAsync(CancellationToken cancellationToken = default);

Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default);
Task<List<TEntity>> QueryAsync(
Expression<Func<TEntity, bool>> predicate,
CancellationToken cancellationToken = default);

Task<List<TEntity>> QueryAsync(QueryParameters queryParameters, CancellationToken cancellationToken = default);
Task<List<TEntity>> QueryAsync(QueryParameters queryParameters, CancellationToken cancellationToken = default);

Task IterateAsync(Expression<Func<TEntity, bool>> predicate, Func<TEntity, Task> callback, CancellationToken cancellationToken = default);
Task IterateAsync(
Expression<Func<TEntity, bool>> predicate,
Func<TEntity, Task> callback,
CancellationToken cancellationToken = default);

Task IterateAsync(QueryParameters queryParameters, Func<TEntity, Task> callback, CancellationToken cancellationToken = default);
Task IterateAsync(
QueryParameters queryParameters,
Func<TEntity, Task> callback,
CancellationToken cancellationToken = default);

Task IterateAsync(Expression<Func<TEntity, bool>> predicate, Action<TEntity> callback, CancellationToken cancellationToken = default);
Task IterateAsync(
Expression<Func<TEntity, bool>> predicate,
Action<TEntity> callback,
CancellationToken cancellationToken = default);

Task IterateAsync(QueryParameters queryParameters, Action<TEntity> callback, CancellationToken cancellationToken = default);
Task IterateAsync(
QueryParameters queryParameters,
Action<TEntity> callback,
CancellationToken cancellationToken = default);

Task<TEntity> CreateAsync(TEntity entity);
Task<TEntity> CreateAsync(TEntity entity);

Task<TEntity> ReplaceAsync(TEntity entity);
Task<TEntity> ReplaceAsync(TEntity entity);

Task<TEntity> UpdateAsync(TId id, TPartitionKey partitionKey, Action<TEntity> updateAction);
Task<TEntity> UpdateAsync(TId id, TPartitionKey partitionKey, Action<TEntity> updateAction);

Task<TEntity> UpdateAsync(TId id, Action<TEntity> updateAction);
Task<TEntity> UpdateAsync(TId id, Action<TEntity> updateAction);

Task<TEntity> UpdateAsync(TId id, TPartitionKey partitionKey, Func<TEntity, Task> updateAction);
Task<TEntity> UpdateAsync(TId id, TPartitionKey partitionKey, Func<TEntity, Task> updateAction);

Task<TEntity> UpdateAsync(TId id, Func<TEntity, Task> updateAction);
Task<TEntity> UpdateAsync(TId id, Func<TEntity, Task> updateAction);

Task DeleteAsync(TId id);
Task DeleteAsync(TId id);

Task DeleteAsync(TId id, TPartitionKey partitionKey);
Task DeleteAsync(TId id, TPartitionKey partitionKey);

Task DeleteAsync(Expression<Func<TEntity, bool>> predicate);
}
Task DeleteAsync(Expression<Func<TEntity, bool>> predicate);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Wemogy.Core.Errors.Exceptions;
using Wemogy.Infrastructure.Database.Core.Abstractions;
using Wemogy.Infrastructure.Database.Core.Errors;
using Wemogy.Infrastructure.Database.Core.Models;
using Wemogy.Infrastructure.Database.Core.ValueObjects;

[assembly: InternalsVisibleTo("Wemogy.Infrastructure.Database.Core.UnitTests")]
[assembly: InternalsVisibleTo("Wemogy.Infrastructure.Database.Cosmos.UnitTests")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ private async Task<Func<TEntity, bool>> GetReadFilter()
return combinedExpressionBody.Compile();
}



internal IDatabaseClient<TEntity, TPartitionKey, TId> GetDatabaseClient()
{
return _database;
Expand Down

0 comments on commit eb37ce9

Please sign in to comment.