... | ... | @@ -215,7 +215,6 @@ using SilaFramework = Sila2.Org.Silastandard; |
|
|
|
|
|
```csharp
|
|
|
...
|
|
|
|
|
|
/// <summary>Base class for server-side implementations of MyFirstFeature</summary>
|
|
|
public abstract partial class MyFirstFeatureBase
|
|
|
{
|
... | ... | @@ -234,7 +233,6 @@ using SilaFramework = Sila2.Org.Silastandard; |
|
|
/// <summary>Client for MyFirstFeature</summary>
|
|
|
public partial class MyFirstFeatureClient : grpc::ClientBase<MyFirstFeatureClient>
|
|
|
{
|
|
|
|
|
|
...
|
|
|
```
|
|
|
|
... | ... | @@ -311,35 +309,31 @@ And we have finished the feature implementation :) |
|
|
|
|
|
1. Add a new class `Server.cs` to the project `MyFirstServer.App`
|
|
|
|
|
|
![20_add_server_class](uploads/aa1e976777a3b1f4945399bb33584658/20_add_server_class.png)
|
|
|
![20_create_server_class](uploads/bea858050f767e5efc8b50e799d181f0/20_create_server_class.png)
|
|
|
![21_name_server_class](uploads/03b3c3c562b688d7935cf7ff42163666/21_name_server_class.png)
|
|
|
|
|
|
2. Add the required usings
|
|
|
```csharp
|
|
|
using System.Net.NetworkInformation;
|
|
|
using Sila2;
|
|
|
using Sila2.Server;
|
|
|
|
|
|
...
|
|
|
```
|
|
|
|
|
|
3. Derive class from `Sila2Server` and auto-create the required constructor that should result in this code:
|
|
|
```csharp
|
|
|
...
|
|
|
|
|
|
internal class Server : SiLA2Server
|
|
|
{
|
|
|
public Server(ServerInformation serverInformation, int portNumber, NetworkInterface networkInterface, string configFile = null) : base(serverInformation, portNumber, networkInterface, configFile)
|
|
|
{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
...
|
|
|
```
|
|
|
|
|
|
4. Modify the constructor to implicitely set the Server information:
|
|
|
```csharp
|
|
|
...
|
|
|
|
|
|
internal class Server : SiLA2Server
|
|
|
{
|
|
|
public Server(int portNumber, NetworkInterface networkInterface, string configFile = null) :
|
... | ... | @@ -348,7 +342,6 @@ internal class Server : SiLA2Server |
|
|
{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
...
|
|
|
```
|
|
|
|
... | ... | @@ -357,7 +350,6 @@ internal class Server : SiLA2Server |
|
|
Add these lines to the constructor:
|
|
|
```csharp
|
|
|
...
|
|
|
|
|
|
{
|
|
|
public Server(int portNumber, NetworkInterface networkInterface, string configFile = null) :
|
|
|
base(new ServerInformation("My First SiLA 2 Server", "This is my first SiLA 2 server", "www.equicon.de", "1.0"),
|
... | ... | @@ -367,7 +359,6 @@ Add these lines to the constructor: |
|
|
this.GrpcServer.Services.Add(Sila2.Org.Silastandard.Examples.Myfirstfeature.V1.MyFirstFeature.BindService(new MyFirstFeatureImpl()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
...
|
|
|
```
|
|
|
|
... | ... | @@ -376,8 +367,8 @@ Add these lines to the constructor: |
|
|
6. Copy the feature definition file `MyFirstFeature.sila.xml` to the output
|
|
|
In order to be able to read the feature file, it has to be copied to the project output. Change the according property of `MyFirstFeature.sila.xml`:
|
|
|
|
|
|
![21_add_feature_definition_file_to_output](uploads/fa0be9c57c85e053a2c38bcddd9d542d/21_add_feature_definition_file_to_output.png)
|
|
|
![22_feature_definition_file_properties](uploads/d3e23482805f1bc3923bfd5dea4e97f4/22_feature_definition_file_properties.png)
|
|
|
![22_feature_file_open_properties](uploads/e39c64585f30554c7b6318b23ebeef5d/22_feature_file_open_properties.png)
|
|
|
![23_set_feature_file_properties](uploads/15f43348610f8ff259154b11e33c8237/23_set_feature_file_properties.png)
|
|
|
|
|
|
7. To create, setup and start the server, modify the application entry point in `Program.cs` as follows:
|
|
|
|
... | ... | @@ -404,7 +395,7 @@ cd examples/MyFirstServer/MyFirstServer.App/bin/Debug/netcoreapp2.2 |
|
|
dotnet MyFirstServer.App.dll
|
|
|
```
|
|
|
|
|
|
![23_running_server](uploads/cd22ffd64fb476261529888f06c5c9c8/23_running_server.png)
|
|
|
![24_running_server](uploads/2a4bc5bc30d276f58cb099d5ba0b5c7e/24_running_server.png)
|
|
|
|
|
|
You can now use the SiLA Browser to check if it can communicate with your SiLA 2 Server, like described [here](https://gitlab.com/SiLA2/sila_base/wikis/SiLA-Browser-Quickstart#install-and-run-the-sila-2-browser)
|
|
|
|
... | ... | |