Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
freever committed Oct 14, 2024
1 parent 3bc0473 commit 2f79fc9
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blauhaus.Common.Utils" Version="2.4.0" />
<PackageReference Include="Blauhaus.Domain.Abstractions" Version="2.0.3" />
<PackageReference Include="Blauhaus.Common.Utils" Version="2.4.4" />
<PackageReference Include="Blauhaus.Responses" Version="0.4.11" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Blauhaus.Ioc.Abstractions" Version="1.6.0" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions src/Blauhaus.ClientActors.Abstractions/IActor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;
using Blauhaus.Common.Abstractions;

namespace Blauhaus.ClientActors.Abstractions;

public interface IActor<TId> : IAsyncDisposable, IAsyncInitializable<TId>, IAsyncReloadable, IHasId<TId>
{

}
1 change: 0 additions & 1 deletion src/Blauhaus.ClientActors.Abstractions/IActorContainer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Blauhaus.Domain.Abstractions.Actors;

namespace Blauhaus.ClientActors.Abstractions
{
Expand Down
13 changes: 13 additions & 0 deletions src/Blauhaus.ClientActors.Abstractions/IClientEntity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using Blauhaus.Domain.Abstractions.Entities;

namespace Blauhaus.ClientActors.Abstractions;

public interface IClientEntity<out TId> : IEntity<TId>
{
long ModifiedAtTicks { get; }
}

public interface IClientEntity : IClientEntity<Guid>
{
}
15 changes: 15 additions & 0 deletions src/Blauhaus.ClientActors.Abstractions/IDtoLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Blauhaus.Common.Abstractions;

namespace Blauhaus.ClientActors.Abstractions;

public interface IDtoLoader<TDto, in TId> : IAsyncPublisher<TDto>
where TDto : class, IHasId<TId>
where TId : IEquatable<TId>
{
Task<TDto> GetOneAsync(TId id);
Task<TDto?> TryGetOneAsync(TId id);
Task<IReadOnlyList<TDto>> GetAllAsync();
}
10 changes: 10 additions & 0 deletions src/Blauhaus.ClientActors.Abstractions/IDtoModelActor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Threading.Tasks;
using Blauhaus.Common.Abstractions;

namespace Blauhaus.ClientActors.Abstractions;

public interface IDtoModelActor<TModel, TDto, TId> : IModelActor<TModel, TId>
where TModel : IHasId<TId>
{
Task<TDto> GetDtoAsync();
}
24 changes: 24 additions & 0 deletions src/Blauhaus.ClientActors.Abstractions/IEntity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Blauhaus.Common.Abstractions;
using System;

namespace Blauhaus.Domain.Abstractions.Entities
{
public interface IEntity<out TId> : IHasId<TId>
{
EntityState EntityState { get; }
}

public interface IEntity: IEntity<Guid>
{

}

}

public enum EntityState
{
Active,
Draft,
Archived,
Deleted
}
10 changes: 10 additions & 0 deletions src/Blauhaus.ClientActors.Abstractions/IModelActor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Threading.Tasks;
using Blauhaus.Common.Abstractions;

namespace Blauhaus.ClientActors.Abstractions;

public interface IModelActor<TModel, TId> : IActor<TId>, IAsyncPublisher<TModel>
where TModel : IHasId<TId>
{
Task<TModel> GetModelAsync();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Blauhaus.Common.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;

namespace Blauhaus.ClientActors.Abstractions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.TestHelpers.MockBuilders;
using Moq;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Common.Abstractions;
using Blauhaus.Common.TestHelpers.MockBuilders;
using Blauhaus.Domain.Abstractions.Actors;
using Moq;

namespace Blauhaus.ClientActors.TestHelpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blauhaus.Common.TestHelpers" Version="2.4.0" />
<PackageReference Include="Blauhaus.Common.TestHelpers" Version="2.4.4" />
<PackageReference Include="Blauhaus.TestHelpers" Version="1.4.4" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Common.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.TestHelpers;

namespace Blauhaus.ClientActors.TestHelpers.Extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Threading.Tasks;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Common.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.TestHelpers.Builders.Base;
using Moq;

Expand Down
8 changes: 3 additions & 5 deletions src/Blauhaus.ClientActors.Tests/.Base/BaseActorTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Blauhaus.Analytics.Abstractions;
using Blauhaus.Analytics.Abstractions.Service;
using Blauhaus.Analytics.TestHelpers.MockBuilders;
using Blauhaus.Analytics.TestHelpers.MockBuilders;
using Blauhaus.Ioc.Abstractions;
using Blauhaus.Ioc.DotNetCoreIocService;
using Blauhaus.TestHelpers.BaseTests;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NUnit.Framework;

namespace Blauhaus.ClientActors.Tests.Base
Expand All @@ -17,10 +16,9 @@ public virtual void Setup()
base.Cleanup();

Services.AddSingleton<IServiceLocator, DotNetCoreServiceLocator>();
Services.AddLogging(x => x.AddDebug());

AddService(x => MockLogger.Object);
}

protected AnalyticsLoggerMockBuilder<TSut> MockLogger => AddMock<AnalyticsLoggerMockBuilder<TSut>, IAnalyticsLogger<TSut>>().Invoke();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using Blauhaus.ClientActors.Tests.Suts;
using Microsoft.Extensions.DependencyInjection;
using System;
using Moq;
using Blauhaus.ClientActors.Tests.Mocks;
using Moq;

namespace Blauhaus.ClientActors.Tests.Actors.DtoModelActorTests.Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blauhaus.Ioc.TestHelpers" Version="1.5.4" />
<PackageReference Include="NUnit" Version="4.0.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Blauhaus.Ioc.DotNetCoreIocService" Version="1.5.4" />
<PackageReference Include="Blauhaus.Ioc.TestHelpers" Version="1.6.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Blauhaus.Ioc.DotNetCoreIocService" Version="1.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Blauhaus.ClientActors.Tests/Suts/ITestActor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.ClientActors.Abstractions;

namespace Blauhaus.ClientActors.Tests.Suts
{
Expand Down
2 changes: 1 addition & 1 deletion src/Blauhaus.ClientActors.Tests/Suts/ITestDtoLoader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Blauhaus.Domain.Abstractions.DtoCaches;
using Blauhaus.ClientActors.Abstractions;

namespace Blauhaus.ClientActors.Tests.Suts
{
Expand Down
2 changes: 1 addition & 1 deletion src/Blauhaus.ClientActors.Tests/Suts/ITestModelActor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.ClientActors.Abstractions;

namespace Blauhaus.ClientActors.Tests.Suts
{
Expand Down
2 changes: 1 addition & 1 deletion src/Blauhaus.ClientActors.Tests/Suts/TestBaseActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.ClientActors.Actors;
using Blauhaus.Domain.Abstractions.Actors;

namespace Blauhaus.ClientActors.Tests.Suts
{
Expand Down
2 changes: 1 addition & 1 deletion src/Blauhaus.ClientActors.Tests/Suts/TestDto.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using Blauhaus.Domain.Abstractions.Entities;
using Blauhaus.ClientActors.Abstractions;

namespace Blauhaus.ClientActors.Tests.Suts
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.ClientActors.Containers;
using Blauhaus.Common.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

Expand Down
3 changes: 0 additions & 3 deletions src/Blauhaus.ClientActors/Actors/BaseDtoModelActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using System.Threading.Tasks;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Common.Abstractions;
using Blauhaus.Common.Utils.Disposables;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.Domain.Abstractions.DtoCaches;

namespace Blauhaus.ClientActors.Actors
{
Expand Down
1 change: 0 additions & 1 deletion src/Blauhaus.ClientActors/Actors/BaseIdActor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;

namespace Blauhaus.ClientActors.Actors
{
Expand Down
1 change: 0 additions & 1 deletion src/Blauhaus.ClientActors/Actors/BaseModelActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Threading.Tasks;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Common.Abstractions;
using Blauhaus.Domain.Abstractions.Actors;

namespace Blauhaus.ClientActors.Actors
{
Expand Down
4 changes: 0 additions & 4 deletions src/Blauhaus.ClientActors/Blauhaus.ClientActors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blauhaus.Domain.Abstractions" Version="2.0.3" />
<PackageReference Include="Blauhaus.Ioc.Abstractions" Version="1.5.4" />
<PackageReference Include="Blauhaus.Responses" Version="0.4.11" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Winton.Extensions.Threading.Actor" Version="1.10.0" />
</ItemGroup>

Expand Down
9 changes: 3 additions & 6 deletions src/Blauhaus.ClientActors/Containers/ActorContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Blauhaus.Analytics.Abstractions;
using Blauhaus.Analytics.Abstractions.Service;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.ClientActors.Actors;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.Ioc.Abstractions;
using Microsoft.Extensions.Logging;
using Winton.Extensions.Threading.Actor;
Expand All @@ -16,7 +13,7 @@ namespace Blauhaus.ClientActors.Containers
public class ActorContainer<TActor, TId> : BaseActorContainer<TActor, TId> where TActor : class, IActor<TId>
{
public ActorContainer(
IAnalyticsLogger<ActorContainer<TActor, TId>> logger,
ILogger<ActorContainer<TActor, TId>> logger,
IServiceLocator serviceLocator)
: base(logger, serviceLocator)
{
Expand All @@ -27,11 +24,11 @@ public abstract class BaseActorContainer<TActor, TId> : BaseActor, IActorContain
where TActor : class, IActor<TId>
{
private readonly IServiceLocator _serviceLocator;
protected readonly IAnalyticsLogger Logger;
protected readonly ILogger Logger;
private readonly Dictionary<TId, TActor> _actorCache = new();

protected BaseActorContainer(
IAnalyticsLogger logger,
ILogger logger,
IServiceLocator serviceLocator)
{
_serviceLocator = serviceLocator;
Expand Down
5 changes: 1 addition & 4 deletions src/Blauhaus.ClientActors/Containers/ModelActorContainer.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Blauhaus.Analytics.Abstractions;
using Blauhaus.Analytics.Abstractions.Service;
using Blauhaus.ClientActors.Abstractions;
using Blauhaus.Common.Abstractions;
using Blauhaus.Common.Utils.Disposables;
using Blauhaus.Domain.Abstractions.Actors;
using Blauhaus.Ioc.Abstractions;
using Microsoft.Extensions.Logging;

Expand All @@ -20,7 +17,7 @@ public class ModelActorContainer<TActor, TId, TModel> : BaseActorContainer<TActo
private readonly List<SavedSubscription> _activeModelSubscriptions = new();

public ModelActorContainer(
IAnalyticsLogger<ModelActorContainer<TActor, TId, TModel>> logger,
ILogger<ModelActorContainer<TActor, TId, TModel>> logger,
IServiceLocator serviceLocator)
: base(logger, serviceLocator)
{
Expand Down

0 comments on commit 2f79fc9

Please sign in to comment.