Giter Club home page Giter Club logo

orchard2's Introduction

brochard MyGet Build Status

Orchard 2

Orchard 2 is the implementation of Orchard CMS in ASP.NET vNext (also known as DNX).

Getting Started

  • First off, follow the instructions here in order to install DNVM, then install Visual Studio 2015, or what ever you flavour of editor is.
  • Next you want to clone the repository using the command git clone https://github.com/OrchardCMS/Orchard2.git and checkout the master branch.
  • Run the build.cmd file included in the repository to bootstrap DNX and build the solution.
  • Next navigate to "D:\Orchard2\src\Orchard.Web" or where ever your retrospective folder is on the command line in Administrator mode.

Using Kestrel

  • Call dnx web.
  • Then open the http://localhost:5001 URL in your browser.

Using Console

  • Call dnx run.
  • From here you can now execute commands in a similar fashion as before.

Using Orchard 2

Creating a host

When running Orchard 2, you need a client. The default implementation is to have a client talk to a host.

The client can be any project that creates the host.

To create the host in a web project you would do:

public class Startup {
    public IServiceProvider ConfigureServices(IServiceCollection services) {
        return services
            // AddHostSample is where the magic is done. This extension method lives in the Host (Orchard.Hosting.Web)
            .AddHostSample()
            .BuildServiceProvider();
    }
}

The host has a small wrapper:

public static IServiceCollection AddHostSample([NotNull] this IServiceCollection services) {
    // This will setup all your core services for a host
    return services.AddHost(internalServices => {
        // The core of the host
        internalServices.AddHostCore();
        //... All extra things you want registered so that you don't have to touch the core host.
    });

Additional module locations

Additional locations for module discovery can be added in your host setup:

public static IServiceCollection AddHostSample([NotNull] this IServiceCollection services) {
    return services.AddHost(internalServices => {
        internalServices.AddHostCore();

        // Add folders the easy way
        internalServices.AddModuleFolder("~/Core/Orchard.Core");
        internalServices.AddModuleFolder("~/Modules");

        // Add folders the move configurable way
        internalServices.Configure<ExtensionHarvestingOptions>(options => {
            var expander = new ModuleLocationExpander(
                DefaultExtensionTypes.Module,
                new[] { "~/Core/Orchard.Core", "~/Modules" },
                "Module.txt"
                );

            options.ModuleLocationExpanders.Add(expander);
        });
    });
}

Tenant Configuration

All tenant configuration lives in src\Orchard.Web\App_Data\Sites\Default within settings files, e.g. Settings.txt:

State: Running
Name: Default
RequestUrlHost: localhost:5001
RequestUrlPrefix:

However, you can override these values within a .json or .xml file. The order of precendence is: Settings.txt -> Settings.xml -> Settings.json

Event Bus

The event bus must be set up in your host (anyone using the default host will have it):

public class ShellModule : IModule {
    public void Configure(IServiceCollection serviceCollection) {
        // More registration
        serviceCollection.AddNotifierEvents(); // The important line
        // More registration
    }
}

This will allow you to register types of IEventHandler, and in turn execute the eventing modal.

Lets take the example of a Dog, you want to tell it to bark..

public interface ITestEvent : IEventHandler {
    void Talk(string value);
}

public class TestEvent1 : ITestEvent {
    public void Talk(string value) {
        Console.WriteLine("Talk Event ONE! " + value);
    }
}

public class TestEvent2 : ITestEvent {
    public void Talk(string value) {
        Console.WriteLine("Talk Event TWO! " + value);
    }
}

Next we want to call all Talk on ITestEvent... You need to inject in IEventNotifier, then call notify on the type of interface you want to call passing the method with the properties to it.

private readonly IEventNotifier _eventNotifier;

public Class1(IEventNotifier eventNotifier) {
    _eventNotifier = eventNotifier;
}

public void Call() {
    _eventNotifier.Notify<ITestEvent>(e => e.Talk("Bark!"));
}

The output will be:

Talk Event ONE! Bark!
Talk Event TWO! Bark!

###Testing

We currently use XUnit to do unit testing, with Coypu and Chrome to do UI testing.

###Contributing

We currently follow the these engineering guidelines.

orchard2's People

Contributors

jetski5822 avatar sebastienros avatar jorisdebock avatar ntaylormullen avatar jtkech avatar alexbocharov avatar benedekfarkas avatar bilalhasankhan avatar juanfranblanco avatar lombiqtechnologies avatar jp311 avatar piedone avatar christianscheuer avatar nicholaspei avatar

Watchers

James Cloos avatar DY avatar  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.