1

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?

2
  • Why go the hard way? The templates in Visual Studio save a lot of time/head scratching. Apr 28, 2015 at 13:24
  • Because I'm new to Orleans. First I learn how it works and why it does what it does, then use the shortcuts :)
    – TheBlueSky
    Apr 28, 2015 at 13:37

3 Answers 3

1

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

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

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.

1
  • Yes, the grain interface project template or grain interface NuGet package will add <Import Project="... .targets"> element to the .csproj, and that will call the code generation during build, that generates the factories based on the interfaces. It means you have to build the grain interface projects first, to use the generated factories in grain projects.
    – lmagyar
    Apr 18, 2015 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.