Skip to content

Commit

Permalink
use options instead of services
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Turowicz committed Jul 25, 2023
1 parent 5025145 commit 750c590
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class OneToMany
{
public class Config : BaseGrainTestConfig, IDisposable
{
protected GrainsOptions options = new GrainsOptions();
protected Mock<IProcessor> processor = new Mock<IProcessor>();
private bool _isDisposed;

Expand All @@ -31,7 +30,6 @@ public Config()

public override void Configure(IServiceCollection services)
{
services.AddSingleton(options);
services.AddSingleton(processor);
services.AddSingleton(processor.Object);
services.AddSingleton<ITransactionService, TransactionService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class OneToManyWait
{
public class Config : BaseGrainTestConfig, IDisposable
{
protected GrainsOptions options = new GrainsOptions();
protected Mock<IProcessor> processor = new Mock<IProcessor>();
private bool _isDisposed;

Expand All @@ -31,7 +30,6 @@ public Config()

public override void Configure(IServiceCollection services)
{
services.AddSingleton(options);
services.AddSingleton(processor);
services.AddSingleton(processor.Object);
services.AddSingleton<ITransactionService, TransactionService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class OneToOne
{
public class Config : BaseGrainTestConfig, IDisposable
{
protected GrainsOptions options = new GrainsOptions();
protected Mock<IProcessor> processor = new Mock<IProcessor>();
private bool _isDisposed;

Expand All @@ -31,7 +30,6 @@ public Config()

public override void Configure(IServiceCollection services)
{
services.AddSingleton(options);
services.AddSingleton(processor);
services.AddSingleton(processor.Object);
services.AddSingleton<ITransactionService, TransactionService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class OneToOneWait
{
public class Config : BaseGrainTestConfig, IDisposable
{
protected GrainsOptions options = new GrainsOptions();
protected Mock<IProcessor> processor = new Mock<IProcessor>();
private bool _isDisposed;

Expand All @@ -31,7 +30,6 @@ public Config()

public override void Configure(IServiceCollection services)
{
services.AddSingleton(options);
services.AddSingleton(processor);
services.AddSingleton(processor.Object);
services.AddSingleton<ITransactionService, TransactionService>();
Expand Down
5 changes: 3 additions & 2 deletions src/Orleans.Streaming.Grains/Grains/TransactionGrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Orleans;
using Orleans.Concurrency;
using Orleans.Streaming.Grains.Abstract;
Expand All @@ -28,9 +29,9 @@ public class TransactionGrain : Grain<TransactionGrainState>, ITransactionGrain,

private bool _isDisposed;

public TransactionGrain(GrainsOptions options, ILoggerFactory logger)
public TransactionGrain(IOptions<GrainsOptions> options, ILoggerFactory logger)
{
_options = options;
_options = options.Value;
_lock = new SemaphoreSlim(1, 1);
_subscriptionTasks = new ConcurrentDictionary<Guid, TaskCompletionSource<bool>>();
_subscriptions = new ObserverManager<ITransactionObserver>(TimeSpan.FromMinutes(5), logger.CreateLogger<TransactionGrain>());
Expand Down
8 changes: 7 additions & 1 deletion src/nuget.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ ARG password
ARG TARGETARCH
ARG BUILDPLATFORM

# Prepare folders
WORKDIR /home/vscode/src
ADD README.md README.md
ADD src/ .

RUN mkdir nuget
# Build and test
RUN dotnet build . -c Release
RUN dotnet test . -c Release --no-build --no-restore

# Nuget pack
RUN mkdir nuget
RUN dotnet pack --no-restore -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:PackageVersion=${version} -o nuget/ Orleans.Streaming.Grains/Orleans.Streaming.Grains.csproj

# Nuget push
WORKDIR /home/vscode/src/nuget
RUN dotnet nuget push -s nuget.org -k ${password} Orleans.Streaming.Grains.${version}.nupkg

0 comments on commit 750c590

Please sign in to comment.