1
votes

I was introduced to project Orleans recently and currently doing some reading and proof-of-concepts.

In addition to the fact that almost all articles and tutorials I came across do not work as is now (mostly due to APIs changes), they also require the installation the Orleans SDK; which contains libraries, documentations, project templates, and so on.

I decided to do it the "hard way" and use the standard project templates (Console application and Class library), and NuGet; with some help from the boilerplate code from Orleans project templates (OrleansHostWrapper).

There is one thing I wasn't able to figure out how to do; which is generating the Grain factory/proxy. When I run the Silo I get the message:

Cannot find generated factory type for interface

Can anyone help in this? Is there another way to generate the factory without the need to install the Orleans SDK?

3
Why go the hard way? The templates in Visual Studio save a lot of time/head scratching.Richard Astbury
Because I'm new to Orleans. First I learn how it works and why it does what it does, then use the shortcuts :)TheBlueSky

3 Answers

1
votes

The easiest way is to add the nuget package Microsoft.Orleans.Templates.Grains or Microsoft.Orleans.Templates.Interfaces to your project, depending on your project type.

https://www.nuget.org/packages/Microsoft.Orleans.Templates.Grains/ https://www.nuget.org/packages/Microsoft.Orleans.Templates.Interfaces/

these add a codegen.cs to your properties which is generated code.

Currently I believe the best practice is to have one project for the interfaces and a separate project for the grain implementation.

1
votes

I don't konw if this is still relevant for you, but the static method for GetGrain is now deprecated.

You will need to do something like this:

var grainFactory = GrainClient.GrainFactory;
var grain = grainFactory.GetGrain<MyGrain>(0);

Keep in mind that "MyGrain" will now have to inherit the "IGrainWithIntegerKey" interface from Orleans.dll.

Hope this helps.

0
votes

I have asked the question in Orleans Codeplex site, and got this answer from Sergey Bykov:

Microsoft.Orleans.Templates.Interfaces for Grain interface projects and Microsoft.Orleans.Templates.Grains for Grain implementation projects enable building those projects with no SDK installed.