Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeralsing committed May 27, 2021
1 parent 98aeea2 commit 2f26632
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Proto.Cluster.CodeGen/Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ public static class Template
using Proto;
using Proto.Cluster;
namespace {{CsNamespace}}
{
public static class GrainExtensions
{
{{#each Services}}
public static {{Name}}Client Get{{Name}}(this Cluster cluster, string identity) => new(cluster, identity);
public static {{Name}}Client Get{{Name}}(this IContext context, string identity) => new(context.System.Cluster(), identity);
{{/each}}
}
{{#each Services}}
public abstract class {{Name}}Base
{
protected IContext Context {get;}
protected ActorSystem System => Context.System;
protected Cluster Cluster => Context.System.Cluster();
protected {{Name}}Base(IContext context)
{
Expand Down Expand Up @@ -112,7 +115,7 @@ class {{Name}}Actor : IActor
{
private {{Name}}Base _inner;
private IContext _context;
private Func<IContext, string, string, {{Name}}Base> _innerFactory;
private Func<IContext, string, string, {{Name}}Base> _innerFactory;
public {{Name}}Actor(Func<IContext, string, string, {{Name}}Base> innerFactory)
{
Expand Down

0 comments on commit 2f26632

Please sign in to comment.