Skip to content

Commit 8e93d28

Browse files
authored
Merge pull request #134 from jacqueskang/history/v2.2.1
History/v2.2.1
2 parents ed092ca + 0cb662e commit 8e93d28

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
A .NET Core lightweight inter-process communication framework allowing invoking a service via named pipeline and/or TCP (in a similar way as WCF, which is currently unavailable for .NET Core). Secure communication over SSL is also supported.
66

7-
Support using primitive or complexe types in service contract.
7+
Support using primitive or complex types in service contract.
88

99
Support multi-threading on server side with configurable number of threads (named pipeline endpoint only).
1010

1111
[ASP.NET Core Dependency Injection framework](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) friendly.
1212

1313
## Usage
1414
1. Create an interface as service contract and package it in an assembly to be shared between server and client.
15-
2. Implement the service and host it in an console or web applciation
16-
3. Invoke the service with framework provided proxy client
15+
2. Implement the service and host it in an console or web applciation.
16+
3. Invoke the service with framework provided proxy client.
1717

1818
## Downloads
1919

@@ -160,4 +160,4 @@ Client certificates are not currently supported.
160160

161161
If you want to process the binary data after serialisation or before deserialisation, for example to add a custom handshake when the connection begins, you can do so using a stream translator. Host and client classes allow you to pass a `Func<Stream, Stream>` stream translation callback in their constructors, which can be used to "wrap" a custom stream around the network stream. This is supported on TCP communications both with and without SSL enabled. See the `XorStream` class in the IpcServiceSample.ServiceContracts project for an example of a stream translator.
162162

163-
Stream translators are also useful for logging packets for debugging. See the `LoggingStream` class in the IpcServiceSample.ServiceContracts project for an example of using a stream translator to log traffic.
163+
Stream translators are also useful for logging packets for debugging. See the `LoggingStream` class in the IpcServiceSample.ServiceContracts project for an example of using a stream translator to log traffic.

src/JKang.IpcServiceFramework.Core/Services/DefaultValueConverter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ public class DefaultValueConverter : IValueConverter
88
{
99
public bool TryConvert(object origValue, Type destType, out object destValue)
1010
{
11+
if (origValue == null)
12+
{
13+
destValue = null;
14+
return destType.IsClass || (Nullable.GetUnderlyingType(destType) != null);
15+
}
16+
1117
if (destType.IsAssignableFrom(origValue.GetType()))
1218
{
1319
// copy value directly if it can be assigned to destType

src/JKang.IpcServiceFramework.Server/IIpcServiceBuilder.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ IIpcServiceBuilder AddService<TInterface, TImplementation>()
1414
IIpcServiceBuilder AddService<TInterface, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory)
1515
where TInterface : class
1616
where TImplementation : class, TInterface;
17+
18+
IIpcServiceBuilder AddService<TInterface>(Func<IServiceProvider, TInterface> implementationFactory)
19+
where TInterface : class;
1720
}
1821
}

src/JKang.IpcServiceFramework.Server/IpcServiceBuilder.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,12 @@ public IIpcServiceBuilder AddService<TInterface, TImplementation>(Func<IServiceP
2727
Services.AddScoped<TInterface, TImplementation>(implementationFactory);
2828
return this;
2929
}
30+
31+
public IIpcServiceBuilder AddService<TInterface>(Func<IServiceProvider, TInterface> implementationFactory)
32+
where TInterface : class
33+
{
34+
Services.AddScoped(implementationFactory);
35+
return this;
36+
}
3037
}
3138
}

0 commit comments

Comments
 (0)