I’m looking into creating projections from C#. As I understand the ProjectionsManager class can be used for that and I’m figuring out how to best create it.
We create our IEventStoreConnection with a connection string:
var connectionString = ConfigurationManager.ConnectionStrings[“EventStore”].ConnectionString;
var connection = EventStoreConnection.Create(connectionString);
My first guess was that I could get a ProjectionsManager from the connection, but that doesn’t seem to be the case.
Then I looked into just new’ing up a ProjectionsManager but then I run into two things
- I have to give it a ILogger. When working with other parts of the client I never have to do that and i’m not sure what to enter here
- It wants an IPEndPoint. Now I would like to have it point to the same server as configured in my IEventStoreConnection but I don’t think I can pull the IP Address out of there. And I Can’t reuse my settings from the IEventStoreConnection because that uses a connectionString and there is no default way to get the IP address out of that.
One thing I just found out is that the Connected event on the IEventStoreConnection has the IP address in its arguments. So I could build something to hold on to the ipadress from that, but that feels a bit like a hack.
Another way would be to ditch the connectionstring and split it up in different part including a seperate IP adress so I could reuse that. But I was kind of happy with the connectionstring.
How are others using the ProjectionsManager? Am I missing something?