Skip to content

Commit 36a7628

Browse files
Merge pull request #198 from AntonioFalcao/release
v3.4
2 parents 332834c + ace9856 commit 36a7628

File tree

32 files changed

+271
-250
lines changed

32 files changed

+271
-250
lines changed

CONTRIBUTING.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## Pull Request Process
9+
10+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11+
build.
12+
2. Update the README.md with details of changes to the interface, this includes new environment
13+
variables, exposed ports, useful file locations and container parameters.
14+
3. Increase the version numbers in any examples files and the README.md to the new version that this
15+
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16+
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
17+
do not have permission to do that, you may request the second reviewer to merge it for you.
18+
19+
## Code of Conduct
20+
21+
### Our Pledge
22+
23+
In the interest of fostering an open and welcoming environment, we as
24+
contributors and maintainers pledge to making participation in our project and
25+
our community a harassment-free experience for everyone, regardless of age, body
26+
size, disability, ethnicity, gender identity and expression, level of experience,
27+
nationality, personal appearance, race, religion, or sexual identity and
28+
orientation.
29+
30+
### Our Standards
31+
32+
Examples of behavior that contributes to creating a positive environment
33+
include:
34+
35+
* Using welcoming and inclusive language
36+
* Being respectful of differing viewpoints and experiences
37+
* Gracefully accepting constructive criticism
38+
* Focusing on what is best for the community
39+
* Showing empathy towards other community members
40+
41+
Examples of unacceptable behavior by participants include:
42+
43+
* The use of sexualized language or imagery and unwelcome sexual attention or
44+
advances
45+
* Trolling, insulting/derogatory comments, and personal or political attacks
46+
* Public or private harassment
47+
* Publishing others' private information, such as a physical or electronic
48+
address, without explicit permission
49+
* Other conduct which could reasonably be considered inappropriate in a
50+
professional setting
51+
52+
### Our Responsibilities
53+
54+
Project maintainers are responsible for clarifying the standards of acceptable
55+
behavior and are expected to take appropriate and fair corrective action in
56+
response to any instances of unacceptable behavior.
57+
58+
Project maintainers have the right and responsibility to remove, edit, or
59+
reject comments, commits, code, wiki edits, issues, and other contributions
60+
that are not aligned to this Code of Conduct, or to ban temporarily or
61+
permanently any contributor for other behaviors that they deem inappropriate,
62+
threatening, offensive, or harmful.
63+
64+
### Scope
65+
66+
This Code of Conduct applies both within project spaces and in public spaces
67+
when an individual is representing the project or its community. Examples of
68+
representing a project or community include using an official project e-mail
69+
address, posting via an official social media account, or acting as an appointed
70+
representative at an online or offline event. Representation of a project may be
71+
further defined and clarified by project maintainers.
72+
73+
### Enforcement
74+
75+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
76+
reported by contacting the project team at arfj@edu.univali.br. All
77+
complaints will be reviewed and investigated and will result in a response that
78+
is deemed necessary and appropriate to the circumstances. The project team is
79+
obligated to maintain confidentiality with regard to the reporter of an incident.
80+
Further details of specific enforcement policies may be posted separately.
81+
82+
Project maintainers who do not follow or enforce the Code of Conduct in good
83+
faith may face temporary or permanent repercussions as determined by other
84+
members of the project's leadership.
85+
86+
### Attribution
87+
88+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
89+
available at [http://contributor-covenant.org/version/1/4][version]
90+
91+
[homepage]: http://contributor-covenant.org
92+
[version]: http://contributor-covenant.org/version/1/4/

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<!--GraphQL-->
1919
<GraphQL_Server_Version>5.0.1</GraphQL_Server_Version>
2020
<GraphQL_Client_Version>3.2.3</GraphQL_Client_Version>
21-
<GraphQL_Version>4.2.0</GraphQL_Version>
21+
<GraphQL_Version>4.3.0</GraphQL_Version>
2222

2323
<!--AutoMapper-->
2424
<AutoMapper_DependencyInjection_Version>8.1.1</AutoMapper_DependencyInjection_Version>
@@ -31,7 +31,7 @@
3131
<HealthChecks_Version>5.0.1</HealthChecks_Version>
3232

3333
<!--Others-->
34-
<FluentValidation_Version>10.0.2</FluentValidation_Version>
34+
<FluentValidation_Version>10.0.4</FluentValidation_Version>
3535
<Scrutor_Version>3.3.0</Scrutor_Version>
3636

3737
</PropertyGroup>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ ___
744744

745745
## Contributing
746746

747-
Available soon!
747+
All contributions are welcome. Please take a look at [contributing](./CONTRIBUTING.md) guide.
748748

749749
## Versioning
750750

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
using Dotnet6.GraphQL4.Domain.Abstractions.Entities;
1+
using System;
2+
using Dotnet6.GraphQL4.Domain.Abstractions.Builders.Extensions;
3+
using Dotnet6.GraphQL4.Domain.Abstractions.Entities;
24

35
namespace Dotnet6.GraphQL4.Domain.Abstractions.Builders
46
{
5-
public abstract class Builder<TBuilder, TEntity, TId> : IBuilder<TEntity, TId>
7+
public abstract class Builder<TBuilder, TEntity, TId> : IBuilder<TBuilder, TEntity, TId>
68
where TBuilder : Builder<TBuilder, TEntity, TId>
79
where TEntity : Entity<TId>
810
where TId : struct
911
{
1012
protected TId Id;
11-
1213
public abstract TEntity Build();
1314

14-
public TBuilder WithId(TId id)
15-
{
16-
Id = id;
17-
return (TBuilder) this;
18-
}
15+
public TBuilder With<TProperty>(Func<TBuilder, TProperty> func)
16+
=> ((TBuilder) this).With<TBuilder, TProperty>(func);
1917
}
2018
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
3+
namespace Dotnet6.GraphQL4.Domain.Abstractions.Builders.Extensions
4+
{
5+
internal static class BuilderExtensions
6+
{
7+
internal static TBuilder With<TBuilder, TProperty>(this TBuilder builder, Func<TBuilder, TProperty> func)
8+
{
9+
func(builder);
10+
return builder;
11+
}
12+
}
13+
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using Dotnet6.GraphQL4.Domain.Abstractions.Entities;
1+
using System;
2+
using Dotnet6.GraphQL4.Domain.Abstractions.Entities;
23

34
namespace Dotnet6.GraphQL4.Domain.Abstractions.Builders
45
{
5-
public interface IBuilder<out TEntity, TId>
6+
public interface IBuilder<out TBuilder, out TEntity, TId>
7+
where TBuilder : IBuilder<TBuilder, TEntity, TId>
68
where TEntity : Entity<TId>
79
where TId : struct
810
{
911
TEntity Build();
12+
TBuilder With<TProperty>(Func<TBuilder, TProperty> func);
1013
}
1114
}

src/Dotnet6.GraphQL4.Domain.Abstractions/DependencyInjection/Extensions/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class ServiceCollectionExtensions
1010
public static IServiceCollection AddBuilders(this IServiceCollection services)
1111
=> services
1212
.Scan(selector => selector.FromAssemblies(Application.Assemblies)
13-
.AddClasses(filter => filter.AssignableTo(typeof(IBuilder<,>)))
13+
.AddClasses(filter => filter.AssignableTo(typeof(IBuilder<,,>)))
1414
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
1515
.AsImplementedInterfaces()
1616
.WithScopedLifetime());
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace Dotnet6.GraphQL4.Domain.Abstractions.ValueObjects
5+
{
6+
public abstract class ValueObject
7+
{
8+
protected static bool EqualOperator(ValueObject left, ValueObject right)
9+
=> (ReferenceEquals(left, null) ^ ReferenceEquals(right, null)) is false &&
10+
(ReferenceEquals(left, null) || left.Equals(right));
11+
12+
protected static bool NotEqualOperator(ValueObject left, ValueObject right)
13+
=> EqualOperator(left, right) is false;
14+
15+
protected abstract IEnumerable<object> GetEqualityComponents();
16+
17+
public override bool Equals(object obj)
18+
=> obj is not null && obj.GetType() == GetType() &&
19+
GetEqualityComponents().SequenceEqual(((ValueObject) obj).GetEqualityComponents());
20+
21+
public override int GetHashCode()
22+
=> GetEqualityComponents()
23+
.Select(x => x != null ? x.GetHashCode() : 0)
24+
.Aggregate((x, y) => x ^ y);
25+
}
26+
}

src/Dotnet6.GraphQL4.Repositories.Abstractions/Transactions/TransactionScopeExecutor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public TransactionScopeExecutor<T> WithConditionAsync(Func<CancellationToken, Ta
5858
return this;
5959
}
6060

61+
public T Execute()
62+
=> Execute(_operation);
63+
64+
public Task<T> ExecuteAsync(CancellationToken cancellationToken)
65+
=> ExecuteAsync(_operationAsync, cancellationToken);
66+
6167
public T Execute(Func<T> operation)
6268
{
6369
using var scope = CreateScope();
@@ -66,12 +72,6 @@ public T Execute(Func<T> operation)
6672
return result;
6773
}
6874

69-
public T Execute()
70-
=> Execute(_operation);
71-
72-
public Task<T> ExecuteAsync(CancellationToken cancellationToken)
73-
=> ExecuteAsync(_operationAsync, cancellationToken);
74-
7575
public async Task<T> ExecuteAsync(Func<CancellationToken, Task<T>> operationAsync, CancellationToken cancellationToken)
7676
{
7777
using var scope = CreateScope();

src/Dotnet6.GraphQL4.Repositories.Abstractions/UnitsOfWork/IUnitOfWork.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace Dotnet6.GraphQL4.Repositories.Abstractions.UnitsOfWork
66
{
77
public interface IUnitOfWork
88
{
9-
TResult ExecuteInTransaction<TResult>(Func<TResult> operation, Func<bool> condition);
10-
Task<TResult> ExecuteInTransactionAsync<TResult>(Func<CancellationToken, Task<TResult>> operationAsync, Func<CancellationToken, Task<bool>> condition, CancellationToken cancellationToken);
9+
TResult ExecuteInTransactionScope<TResult>(Func<TResult> operation, Func<bool> condition);
10+
Task<TResult> ExecuteInTransactionScopeAsync<TResult>(Func<CancellationToken, Task<TResult>> operationAsync, Func<CancellationToken, Task<bool>> condition, CancellationToken cancellationToken);
1111

1212
bool SaveChanges();
1313
Task<bool> SaveChangesAsync(CancellationToken cancellationToken);

0 commit comments

Comments
 (0)