blob: 912ea011c1deed06cf661db5770bca7e785d9fae [file] [log] [blame] [view]
Jens Geyeraa0c8b32019-01-28 23:27:45 +01001# Apache Thrift netstd
2
3Thrift client library for Microsoft .NET Standard
4
5# Build the library
6
7## How to build on Windows
Sven Roederer3caf9632024-07-16 14:46:18 +02008- Get Thrift IDL compiler executable, add to some folder and add path to this folder into PATH variable.
9- Alternatively, build from source by using the cmake target "copy-thrift-compiler", which places the binary to a suitable place.
Jens Geyeraa0c8b32019-01-28 23:27:45 +010010- Open the Thrift.sln project with Visual Studio and build.
11or
12- Build with scripts
13
14## How to build on Unix/Linux
Sven Roederer3caf9632024-07-16 14:46:18 +020015- Ensure you have a suitable .NET Core SDK installed, or use the [Ubuntu docker image](../../build/docker/README.md)
Jens Geyeraa0c8b32019-01-28 23:27:45 +010016- Follow common automake build practice: `./ bootstrap && ./ configure && make`
17
18## Known issues
19- In trace logging mode you can see some not important internal exceptions
20
21# Migration to netstd
22
23## ... from netcore
24
25If you are migrating your code from netcore library, you will have to:
26
27- Switch to `thrift -gen netstd`
28- the following compiler flags are no longer needed or supported: `hashcode` is now standard, while `nullable` is no longer supported.
29- the `Thrift.Transport` and `Thrift.Protocol` namespaces now use the singular form
30- add `using Thrift.Processor;` in the server code where appropriate
31- rename all `T*ClientTransport` to `T*Transport`
32- rename all `TBaseServer` occurrences in your code to `TServer`
33- the `SingletonTProcessorFactory` is now called `TSingletonProcessorFactory`
34- and the `AsyncBaseServer` is now the `TSimpleAsyncServer`
35
36You 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.
37
38## ... from csharp
39
40Because 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.
41
421. Client and server applications must use at least framework 4.6.1, any version below will not work.
431. 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.
441. [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).
451. Consider proper use of `cancellationToken` parameters. They are optional but may be quite helpful.
461. As you probably already guessed, there are a few names that have been changed:
47- add `using Thrift.Processor;` in the server code where appropriate
48- the `TServerSocket` is now called `TServerSocketTransport`
49- change `IProtocolFactory` into `ITProtocolFactory`
50- if you are looking for `TSimpleServer`, try `TSimpleAsyncServer` instead
51- similarly, the `TThreadPoolServer` is now a `TThreadPoolAsyncServer`
52- the server's `Serve()` method does now `ServeAsync()`
53- In case you are using Thrift server event handlers: the `SetEventHandler` method now starts with an uppercase letter
54- and you will also have to revise the method names of all `TServerEventHandler` descendants you have in your code
55