Install Nuget Package

PM> Install-Package Firestorm.Stems

That's all you need to start writing Stem classes! For good separation, you can keep your Stem classes in their own assembly.

Configuring Stems

In your configuration builder, use the AddStems extension.

services.AddFirestorm()
    .AddStems()

By default, this will scan the calling assembly for all classes that derive from Stem. There are other overloads of AddStems that allow you to specify the assembly and root namespace of your Stems.

StemConfiguration

The factory requires a StemConfiguration object, which contains your stem configuration. This contains further settings related to Stems.

RootResourceFactory

The StartResourceFactory requires a RootResourceFactory to feed the Stems with the data they need. There are a couple of different ways to define Roots.

In these examples, we will use the DataSourceRootFactory to use Entity Framework Core for the Root data.

Note

There are plans to redesign Roots as a separate IDataSource implementation, meaning there would be no need for this extra RootResourceFactory.

Web Startup

Now you can use your configuration object in your web startup.

ASP.NET Core 2.0

Note

This example uses ASP.NET Core but you can use the same config with other web technologies.

PM> Install-Package Firestorm.AspNetCore2
public class Startup
{
    public void Configure(IApplicationBuilder app)
    {
        app.UseFirestorm(new FirestormConfiguration
        {
            StartResourceFactory = new StemsStartResourceFactory
            {
                RootFactory = new DataSourceRootFactory
                {
                    StemsNamespace = "YourApplication.Stems",
                    DataSource = new EntitiesDataSource<YourApplication.Data.EntitiesContext>()
                }
            }
        });
    }
}

ASP.NET Core Extensions

Alternatively you can use the extensions.

PM> Install-Package Firestorm.Extensions.AspNetCore2
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddFirestorm()
            .AddStems("YourApplication.Stems")
            .AddEntityFramework<YourApplication.Data.EntitiesContext>();
    }

    public void Configure(IApplicationBuilder app)
    {
        app.UseFirestorm();
    }
}