Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Greeter demo for C# #241

Merged
merged 1 commit into from
Jan 28, 2025
Merged

Conversation

bernardnormier
Copy link
Member

This new greeter demo is a port of the IceRPC slice/Greeter example. In particular, it uses a similar layout and build system.

@@ -0,0 +1,17 @@
// Copyright (c) ZeroC, Inc.

// Extends Program to provide the CancelKeyPressed property.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In icerpc-csharp, this file is in a common folder.

internal class Chatbot : GreeterDisp_
{
// Implements the abstract method greet from the GreeterDisp_ class generated by the Slice compiler.
public override string greet(string name, Ice.Current current)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a "sync" dispatch, which is the simplest, and certainly ok when the dispatch is indeed sync.

Should I add a GreeterAsync demo that shows AMD, similar to the C++ greeterAsync demo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't.


// Send a request to the remote object and get the response.
// TODO: remap to GreetAsync with cs:identifier
string greeting = await greeter.greetAsync(Environment.UserName);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only demo the client-side async API. The sync API is for backwards compatibility - you probably shouldn't use it in new applications.

You can build the client and server applications with:

``` shell
dotnet build
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was building with:

dotnet build /p:IceHome=$HOME/builds/ice /p:IceToolsPath=$HOME/builds/ice/cpp/bin

internal class Chatbot : GreeterDisp_
{
// Implements the abstract method greet from the GreeterDisp_ class generated by the Slice compiler.
public override string greet(string name, Ice.Current current)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't.

@bernardnormier bernardnormier merged commit 025af48 into zeroc-ice:main Jan 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants