Skip to content

Commit 0e95adf

Browse files
committed
Moving Akka to NetStandard. Part 1
1 parent 6aaa0b9 commit 0e95adf

File tree

126 files changed

+577
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+577
-170
lines changed

src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ private void CreateCoordinator()
295295

296296
foreach (var typeName in typeNames)
297297
{
298-
var rebalanceEnabled = string.Equals(typeName, "rebalancing", StringComparison.InvariantCultureIgnoreCase);
298+
var rebalanceEnabled = string.Equals(typeName, "rebalancing", StringComparison.OrdinalIgnoreCase);
299299
var singletonProps = Props.Create(() => new BackoffSupervisor(
300300
CoordinatorProps(typeName, rebalanceEnabled),
301301
"coordinator",

src/contrib/cluster/Akka.Cluster.Sharding/Serialization/ClusterShardingMessageSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ private static byte[] Compress(IMessageLite message)
325325
using (var gzipStream = new GZipStream(bos, CompressionMode.Compress))
326326
{
327327
message.WriteTo(gzipStream);
328-
gzipStream.Close();
328+
gzipStream.Dispose();
329329
return bos.ToArray();
330330
}
331331
}

src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Serialization/DistributedPubSubMessageSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private byte[] Compress(IMessageLite message)
9393
using (var gzipStream = new GZipStream(bos, CompressionMode.Compress))
9494
{
9595
message.WriteTo(gzipStream);
96-
gzipStream.Close();
96+
gzipStream.Dispose();
9797
return bos.ToArray();
9898
}
9999
}

src/contrib/persistence/Akka.Persistence.Sql.Common/Akka.Persistence.Sql.Common.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
<DebugType>full</DebugType>
1818
<Optimize>false</Optimize>
1919
<OutputPath>bin\Debug\</OutputPath>
20-
<DefineConstants>DEBUG;TRACE</DefineConstants>
20+
<DefineConstants>DEBUG;TRACE;SERIALIZATION;CONFIGURATION</DefineConstants>
2121
<ErrorReport>prompt</ErrorReport>
2222
<WarningLevel>4</WarningLevel>
2323
</PropertyGroup>
2424
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2525
<DebugType>pdbonly</DebugType>
2626
<Optimize>true</Optimize>
2727
<OutputPath>bin\Release\</OutputPath>
28-
<DefineConstants>TRACE</DefineConstants>
28+
<DefineConstants>TRACE;SERIALIZATION;CONFIGURATION</DefineConstants>
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>
3131
<DocumentationFile>bin\Release\Akka.Persistence.Sql.Common.xml</DocumentationFile>

src/contrib/persistence/Akka.Persistence.Sql.Common/InternalExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
//-----------------------------------------------------------------------
77

88
using System;
9+
using System.Reflection;
910

1011
namespace Akka.Persistence.Sql.Common
1112
{
1213
internal static class InternalExtensions
1314
{
1415
public static string QualifiedTypeName(this Type type)
1516
{
16-
return type.FullName + ", " + type.Assembly.GetName().Name;
17+
return type.FullName + ", " + type.GetTypeInfo().Assembly.GetName().Name;
1718
}
1819
}
1920
}

src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/QueryApi.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public interface ISubscriptionCommand { }
2020
/// Used by query-side. The journal will send <see cref="EventAppended"/> messages to
2121
/// the subscriber when <see cref="AsyncWriteJournal.WriteMessagesAsync"/> has been called.
2222
/// </summary>
23+
#if SERIALIZATION
2324
[Serializable]
25+
#endif
2426
public sealed class SubscribePersistenceId : ISubscriptionCommand
2527
{
2628
public readonly string PersistenceId;
@@ -31,7 +33,9 @@ public SubscribePersistenceId(string persistenceId)
3133
}
3234
}
3335

36+
#if SERIALIZATION
3437
[Serializable]
38+
#endif
3539
public sealed class EventAppended
3640
{
3741
public readonly string PersistenceId;
@@ -48,14 +52,18 @@ public EventAppended(string persistenceId)
4852
/// subscriber followed by <see cref="PersistenceIdAdded"/> messages when new persistenceIds
4953
/// are created.
5054
/// </summary>
55+
#if SERIALIZATION
5156
[Serializable]
57+
#endif
5258
public sealed class SubscribeAllPersistenceIds : ISubscriptionCommand
5359
{
5460
public static readonly SubscribeAllPersistenceIds Instance = new SubscribeAllPersistenceIds();
5561
private SubscribeAllPersistenceIds() { }
5662
}
5763

64+
#if SERIALIZATION
5865
[Serializable]
66+
#endif
5967
public sealed class CurrentPersistenceIds
6068
{
6169
public readonly IEnumerable<string> AllPersistenceIds;
@@ -66,7 +74,9 @@ public CurrentPersistenceIds(IEnumerable<string> allPersistenceIds)
6674
}
6775
}
6876

77+
#if SERIALIZATION
6978
[Serializable]
79+
#endif
7080
public sealed class PersistenceIdAdded
7181
{
7282
public readonly string PersistenceId;
@@ -84,7 +94,9 @@ public PersistenceIdAdded(string persistenceId)
8494
/// Events are tagged by wrapping in <see cref="Tagged"/>
8595
/// via an <see cref="IEventAdapter"/>.
8696
/// </summary>
97+
#if SERIALIZATION
8798
[Serializable]
99+
#endif
88100
public sealed class SubscribeTag : ISubscriptionCommand
89101
{
90102
public readonly string Tag;
@@ -95,7 +107,9 @@ public SubscribeTag(string tag)
95107
}
96108
}
97109

110+
#if SERIALIZATION
98111
[Serializable]
112+
#endif
99113
public sealed class TaggedEventAppended
100114
{
101115
public readonly string Tag;
@@ -106,7 +120,9 @@ public TaggedEventAppended(string tag)
106120
}
107121
}
108122

123+
#if SERIALIZATION
109124
[Serializable]
125+
#endif
110126
public sealed class ReplayTaggedMessages
111127
{
112128
public readonly long FromOffset;
@@ -130,7 +146,9 @@ public ReplayTaggedMessages(long fromOffset, long toOffset, long max, string tag
130146
}
131147
}
132148

149+
#if SERIALIZATION
133150
[Serializable]
151+
#endif
134152
public sealed class ReplayedTaggedMessage : INoSerializationVerificationNeeded
135153
{
136154
public readonly IPersistentRepresentation Persistent;

src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/QueryExecutor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public interface IJournalQueryExecutor
7474
Task SelectEventsAsync(DbConnection connection, CancellationToken cancellationToken, IEnumerable<IHint> hints, Action<IPersistentRepresentation> callback);
7575
}
7676

77+
#if SERIALIZATION
7778
[Serializable]
79+
#endif
7880
public class QueryConfiguration
7981
{
8082
public readonly string TagsColumnName;

src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/SqlJournal.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System;
99
using System.Collections.Generic;
1010
using System.Collections.Immutable;
11-
using System.Configuration;
1211
using System.Data.Common;
1312
using System.Linq;
1413
using System.Threading;
@@ -404,10 +403,13 @@ public override async Task<long> ReadHighestSequenceNrAsync(string persistenceId
404403
protected virtual string GetConnectionString()
405404
{
406405
var connectionString = _settings.ConnectionString;
406+
407+
#if CONFIGURATION
407408
if (string.IsNullOrEmpty(connectionString))
408409
{
409-
connectionString = ConfigurationManager.ConnectionStrings[_settings.ConnectionStringName].ConnectionString;
410+
connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[_settings.ConnectionStringName].ConnectionString;
410411
}
412+
#endif
411413

412414
return connectionString;
413415
}

src/contrib/persistence/Akka.Persistence.Sql.Common/Queries/Hints.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ public static IHint TimestampBetween(long from, long to)
9393
/// <summary>
9494
/// Hint for the SQL journal used to filter journal entries returned in the response based on the manifest.
9595
/// </summary>
96+
#if SERIALIZATION
9697
[Serializable]
98+
#endif
9799
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
98100
public sealed class WithManifest : IHint, IEquatable<WithManifest>
99101
{
@@ -130,7 +132,9 @@ public override string ToString()
130132
/// <summary>
131133
/// Hint for the SQL journal used to filter journal entries returned in the response based on set of perisistence ids provided.
132134
/// </summary>
135+
#if SERIALIZATION
133136
[Serializable]
137+
#endif
134138
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
135139
public sealed class PersistenceIdRange : IHint, IEquatable<PersistenceIdRange>
136140
{
@@ -170,7 +174,9 @@ public override string ToString()
170174
/// Desired behavior of timestamp range is &lt;from, to) - left side inclusive, right side exclusive.
171175
/// Timestamp is generated by <see cref="JournalDbEngine.GenerateTimestamp"/> method, which may be overloaded.
172176
/// </summary>
177+
#if SERIALIZATION
173178
[Serializable]
179+
#endif
174180
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
175181
public sealed class TimestampRange : IHint, IEquatable<TimestampRange>
176182
{

src/contrib/persistence/Akka.Persistence.Sql.Common/Queries/Query.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public interface IQueryReply { }
2424
/// set of events not based on any partition key. Therefore query request don't need to contain
2525
/// partition id of the persistent actor.
2626
/// </summary>
27+
#if SERIALIZATION
2728
[Serializable]
29+
#endif
2830
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
2931
public sealed class Query: IEquatable<Query>
3032
{
@@ -73,7 +75,9 @@ public override string ToString()
7375
/// Message send back from SQL-based journal to <see cref="Query"/> sender,
7476
/// when the query execution has been completed and result is returned.
7577
/// </summary>
78+
#if SERIALIZATION
7679
[Serializable]
80+
#endif
7781
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
7882
public sealed class QueryResponse : IQueryReply, IEquatable<QueryResponse>
7983
{
@@ -116,7 +120,9 @@ public override string ToString()
116120
/// <summary>
117121
/// Message send back from SQL-based journal, when <see cref="Query"/> has been successfully responded.
118122
/// </summary>
123+
#if SERIALIZATION
119124
[Serializable]
125+
#endif
120126
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
121127
public sealed class QuerySuccess : IQueryReply, IEquatable<QuerySuccess>
122128
{
@@ -153,7 +159,9 @@ public override string ToString()
153159
/// <summary>
154160
/// Message send back from SQL-based journal to <see cref="Query"/> sender, when the query execution has failed.
155161
/// </summary>
162+
#if SERIALIZATION
156163
[Serializable]
164+
#endif
157165
[Obsolete("Existing SQL persistence query will be obsoleted, once Akka.Persistence.Query will came out")]
158166
public sealed class QueryFailure : IQueryReply, IEquatable<QueryFailure>
159167
{

0 commit comments

Comments
 (0)