README.md
1# Apache Thrift netstd
2
3Thrift client library for Microsoft .NET Standard
4
5# Build the library
6
7## How to build on Windows
8- Get Thrift IDL compiler executable, add to some folder and add path to this folder into PATH variable
9- Open the Thrift.sln project with Visual Studio and build.
10or
11- Build with scripts
12
13## How to build on Unix/Linux
14- Ensure you have .NET Core SDK 3.1 (LTS) installed, or use the [Ubuntu docker image](../../build/docker/README.md)
15- Follow common automake build practice: `./ bootstrap && ./ configure && make`
16
17## Known issues
18- In trace logging mode you can see some not important internal exceptions
19
20# Migration to netstd
21
22## ... from netcore
23
24If you are migrating your code from netcore library, you will have to:
25
26- Switch to `thrift -gen netstd`
27- the following compiler flags are no longer needed or supported: `hashcode` is now standard, while `nullable` is no longer supported.
28- the `Thrift.Transport` and `Thrift.Protocol` namespaces now use the singular form
29- add `using Thrift.Processor;` in the server code where appropriate
30- rename all `T*ClientTransport` to `T*Transport`
31- rename all `TBaseServer` occurrences in your code to `TServer`
32- the `SingletonTProcessorFactory` is now called `TSingletonProcessorFactory`
33- and the `AsyncBaseServer` is now the `TSimpleAsyncServer`
34
35You may wonder why we changed so many names. The naming scheme has been revised for two reasons: First, we want to get back the established, well-known naming consistency across the Thrift libraries which the netcore library did not fully respect. Second, by achieving that first objective, we get the additional benefit of making migration at least a bit easier for C# projects.
36
37## ... from csharp
38
39Because of the different environment requirements, migration from C# takes slightly more efforts. While the code changes related to Thrift itself are moderate, you may need to upgrade certain dependencies, components or even modules to more recent versions.
40
411. Client and server applications must use at least framework 4.6.1, any version below will not work.
421. Switch to `thrift -gen netstd`. The following compiler flags are no longer needed or supported: `hashcode` and `async` are now standard, while `nullable` is no longer supported.
431. [Familiarize yourself with the `async/await` model](https://msdn.microsoft.com/en-us/magazine/jj991977.aspx), if you have not already done so. As netstd does not support `ISync` anymore, async is mandatory. The synchronous model is simply no longer available (that's also the reason why we don't need the `async` flag anymore).
441. Consider proper use of `cancellationToken` parameters. They are optional but may be quite helpful.
451. As you probably already guessed, there are a few names that have been changed:
46- add `using Thrift.Processor;` in the server code where appropriate
47- the `TServerSocket` is now called `TServerSocketTransport`
48- change `IProtocolFactory` into `ITProtocolFactory`
49- if you are looking for `TSimpleServer`, try `TSimpleAsyncServer` instead
50- similarly, the `TThreadPoolServer` is now a `TThreadPoolAsyncServer`
51- the server's `Serve()` method does now `ServeAsync()`
52- In case you are using Thrift server event handlers: the `SetEventHandler` method now starts with an uppercase letter
53- and you will also have to revise the method names of all `TServerEventHandler` descendants you have in your code
54
55