Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
Added generic overloads for ChronicleBuilder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
GooRiOn committed Oct 23, 2018
1 parent ef1f93a commit 2c6d259
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/Chronicle/Builders/ChronicleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ public IChronicleBuilder UseInMemoryPersistence()
return this;
}

public IChronicleBuilder UseSagaLog<TSagaLog>() where TSagaLog : ISagaLog
=> UseSagaLog(typeof(TSagaLog));

public IChronicleBuilder UseSagaLog(Type sagaLogType)
{
Check.Is<ISagaLog>(sagaLogType, ChronicleBuilderErrorMessages.InvalidSagaLogType);
Services.AddTransient(typeof(ISagaLog), sagaLogType);
return this;
}

public IChronicleBuilder UseSagaDataRepository<TRepository>() where TRepository : ISagaDataRepository
=> UseSagaDataRepository(typeof(TRepository));

public IChronicleBuilder UseSagaDataRepository(Type repositoryType)
{
Check.Is<ISagaDataRepository>(repositoryType, ChronicleBuilderErrorMessages.InvalidSagaDataRepositoryType);
Expand Down
6 changes: 3 additions & 3 deletions src/Chronicle/Chronicle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<PackageLicenseUrl>https://github.com/chronicle-stack/Chronicle/blob/master/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://avatars1.githubusercontent.com/u/42150754?s=200</PackageIconUrl>
<VersionPrefix>1.3.0</VersionPrefix>
<Version>1.4.3</Version>
<AssemblyVersion>1.4.3.0</AssemblyVersion>
<FileVersion>1.4.3.0</FileVersion>
<Version>1.5.0</Version>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<FileVersion>1.5.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Chronicle/IChronicleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ public interface IChronicleBuilder
{
IServiceCollection Services { get; }
IChronicleBuilder UseInMemoryPersistence();
IChronicleBuilder UseSagaLog<TSagaLog>() where TSagaLog : ISagaLog;
IChronicleBuilder UseSagaLog(Type sagaLogType);
IChronicleBuilder UseSagaDataRepository<TRepository>() where TRepository : ISagaDataRepository;
IChronicleBuilder UseSagaDataRepository(Type repositoryType);
}
}

0 comments on commit 2c6d259

Please sign in to comment.