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

C sharp support #39

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

DBMasterC
Copy link
Contributor

Humble addition which I'm using to generate some C# clients based on how they're defined on our backend. Among other things, It's not regenerating a hub, and the output could be prettier, but I'm curious your take on it as a first step.

@Insire
Copy link

Insire commented Jan 18, 2021

I'd be interested in this.

@ViRuSTriNiTy
Copy link

ViRuSTriNiTy commented May 31, 2021

@DBMasterC Would you please provide some info on how to use your changes? Generating C# clients it pretty much what I need but I am a bit puzzled on how to do it.

@DBMasterC
Copy link
Contributor Author

@DBMasterC Would you please provide some info on how to use your changes? Generating C# clients it pretty much what I also need but I am a bit puzzled on how to do it.

While I am using this in "production", my signalR footprint is very small, and this is very much more a PoC effort at the functionality than it is a full-featured, ready-to-go part of this library.

Anyhow, I use it in much the same way as the SigSpecToTypescriptGenerator:

var csharpGenSettings = new SigSpecToCSharpGeneratorSettings();
csharpGenSettings.CSharpGeneratorSettings.Namespace = "Namespace.SignalR.Clients";
var csharpGenerator = new SigSpecToCSharpGenerator(csharpGenSettings);
string file2 = csharpGenerator.GenerateClients(document);
targetFile = new FileInfo(args[1].Trim('\''));
await File.WriteAllTextAsync(targetFile.FullName, file2);
Console.WriteLine($"Generated SigSpec CSharp code to {targetFile.FullName}");

@danzel
Copy link
Contributor

danzel commented Sep 2, 2021

FYI, as an alternative to generating c# clients, you could use https://github.com/mehmetakbulut/SignalR.Strong

Console.WriteLine("\nGenerated SigSpec document:");
Console.WriteLine(json);
Console.ReadKey();

var codeGeneratorSettings = new SigSpecToTypeScriptGeneratorSettings();
Copy link
Owner

Choose a reason for hiding this comment

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

Can you maybe keep the ts code here (commented) so we have both samples here?

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.

5 participants