Created
April 9, 2019 11:47
-
-
Save alieniasty/ed6bdecc67aebf2ad7826ade969dd31a to your computer and use it in GitHub Desktop.
How to perform DI in F#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace HelloWorld.Grains | |
{ | |
/// <summary> | |
/// Orleans grain implementation class HelloGrain. | |
/// </summary> | |
public class HelloGrain : Orleans.Grain, IHello | |
{ | |
private readonly ILogger logger; | |
public HelloGrain(ILogger<HelloGrain> logger) | |
{ | |
this.logger = logger; | |
} | |
Task<string> IHello.SayHello(string greeting) | |
{ | |
logger.LogInformation($"SayHello message received: greeting = '{greeting}'"); | |
return Task.FromResult($"You said: '{greeting}', I say: Hello!"); | |
} | |
} | |
} | |
turns into | |
type HelloGrain(log:ILogger<HelloGrain>) = | |
inherit Grain<SampleHolder>() | |
let logger = log | |
interface ISample with {..} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment