Git Product home page Git Product logo

orleans-templates's Introduction

NuGet Gitter

Overview

This project contains the templates for getting started with Orleans.

The templates are leveraging the dotnet templating engine.

Installation

The templates can be consumed in two ways.

Visual Studio 2017

If you like to use the project templates from Visual Studio 2017, the minimum supported version is 15.3, since this version added support to the unfolding of templates based on the new dotnet templating engine.

VS Gallery link: Microsoft Orleans Templates

Template updates for Visual Studio 2017 can be done by updating the installed VSIX.

.NET Core command-line (CLI)

.NET Core command-line (CLI) template installation can be done by invoking dotnet.exe from the shell. The minimum version required is 2.0.

dotnet new --install Microsoft.Orleans.Templates::*

The template installation can be checked with the following command line:

dotnet new

The output should contain the Orleans Templates amongst the other installed templates:

Templates                                         Short Name           Language          Tags
---------------------------------------------------------------------------------------------------------------------
Orleans Grain Class Collection                    grains               [C#], F#, VB      Orleans
Orleans Grain Interface Collection                graininterfaces      [C#], VB          Orleans
Orleans Client Application                        clusterclient        [C#]              Orleans
Orleans Silo Host                                 silohost             [C#]              Orleans
Orleans Grain Interface                           graininterface       [C#]              Orleans
Orleans Solution                                  orleans              [C#]              Orleans

Creating your first Orleans application

Execute the following command from any CLI shell.

dotnet new orleans -n Contoso

You should now have a Contoso directory with a solution setup and ready to go. The directory structure will look like:

  • Contoso.sln
  • src
    • ClusterClient
    • Grains
    • GrainInterfaces
    • SiloHost

You can even open it with VS Code, build, and run it out of the box. Of course, you don't have to use VS Code, you could use Visual Studio, or VIM and the dotnet CLI.

If you are using VS Code, be sure and select the "Silo Host / Cluster Client" debug configuration to launch the Silo Host and the Cluster Client at the same time.

Creating your second Orleans application

Of course, sometimes the first steps require a steadier footing. If you want to manage the solution from the ground up, you're welcome to add each component individually.

The following commands should be executed from any CLI shell.

Create a Blank Solution:

dotnet new sln -n Contoso

Create the Grain interfaces project and add it to the Solution:

dotnet new graininterfaces -n Contoso.GrainInterfaces
dotnet sln add Contoso.GrainInterfaces\Contoso.GrainInterfaces.csproj

Create the Grain implementation project and add it to the Solution:

dotnet new grains -n Contoso.Grains
dotnet sln add Contoso.Grains\Contoso.Grains.csproj

Add a project reference for the Grain interface project to the Grain implementation project:

dotnet add Contoso.Grains reference Contoso.GrainInterfaces\Contoso.GrainInterfaces.csproj

Add using Contoso.GrainInterfaces; to the Contoso.Grains\Grain1.cs file.

Create the Silo host project and add it to the Solution:

dotnet new silohost -n Contoso.Silo
dotnet sln add Contoso.Silo\Contoso.Silo.csproj

Add a project reference for the Grain implementation project to the Silo host project:

dotnet add Contoso.Silo reference Contoso.Grains\Contoso.Grains.csproj

Add using Contoso.Grains; to the Contoso.SiloHost\Program.cs file.

After the UseConfiguration(config) line in Program.cs add, to register the grain classes with the Silo: .AddApplicationPartsFromReferences(typeof(Grain1).Assembly)

Create a cluster client application and add it to the Solution:

dotnet new orleansclient -n Contoso.ClusterClient
dotnet sln add Contoso.ClusterClient\Contoso.ClusterClient.csproj

Add a project reference for the Grain interface project to the Cluster Client application project:

dotnet add Contoso.ClusterClient reference Contoso.GrainInterfaces\Contoso.GrainInterfaces.csproj

Add using Contoso.GrainInterfaces; to the Contoso.ClusterClient\Program.cs file.

After the UseConfiguration(config) line in Program.cs add, to register the grain interfaces with the client: .AddApplicationPartsFromReferences(typeof(IGrain1).Assembly)

Build the solution:

dotnet build

Congratulations, you created your first - yet empty - Orleans application.

Now you can add methods to the Grain interfaces project and Grain implementation project, then call it from the client application.

Building the template solution

The template project is an old style csproj, so it only can built with MSBuild.exe. Since the Package Restore is not automatic in this case that's must be done first.

Since NuGet workload was not part of VS Build payload before 15.4, on build servers 15.4 needed.

On a desktop Visual Studio 2017 installation a Developer Command Prompt need to be opened, then the following 2 commands are building the solution:

msbuild /t:restore
msbuild

Contribution

If you like to contribute to the development of Orleans Templates, here are some useful links about dotnet templates:

Blog

Orleans Blog is a place to share our thoughts, plans, learnings, tips and tricks, and ideas, crazy and otherwise, which don’t easily fit the documentation format. We would also like to see here posts from the community members, sharing their experiences, ideas, and wisdom. So, welcome to Orleans Blog, both as a reader and as a blogger!

Community

License

This project is licensed under the MIT license.

Quick Links

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

orleans-templates's People

Contributors

jdom avatar sergeybykov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.