Skip to content

Commit

Permalink
Updating Readmy file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jetski5822 committed Jan 3, 2016
1 parent b9acbb7 commit 14ad173
Showing 1 changed file with 20 additions and 63 deletions.
83 changes: 20 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Startup {
The host has a small wrapper:

```c#
public static IServiceCollection AddHostSample([NotNull] this IServiceCollection services) {
public static IServiceCollection AddHostSample(this IServiceCollection services) {
// This will setup all your core services for a host
return services.AddHost(internalServices => {
// The core of the host
Expand All @@ -62,19 +62,21 @@ public static IServiceCollection AddHostSample([NotNull] this IServiceCollection

### Additional module locations

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

```c#
public static IServiceCollection AddHostSample([NotNull] this IServiceCollection services) {
return services.AddHost(internalServices => {
internalServices.AddHostCore();
public class Startup {
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddWebHost();

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

// Add folders the move configurable way
internalServices.Configure<ExtensionHarvestingOptions>(options => {
// Add folders the more configurable way
services.Configure<ExtensionHarvestingOptions>(options => {
var expander = new ModuleLocationExpander(
DefaultExtensionTypes.Module,
new[] { "~/Core/Orchard.Core", "~/Modules" },
Expand All @@ -101,68 +103,23 @@ 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):

```c#
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..

```c#
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.
You can also override the 'Sites' folder in your client setup

```c#
private readonly IEventNotifier _eventNotifier;

public Class1(IEventNotifier eventNotifier) {
_eventNotifier = eventNotifier;
}
public class Startup {
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddWebHost();

public void Call() {
_eventNotifier.Notify<ITestEvent>(e => e.Talk("Bark!"));
// Change the folder name here
services.ConfigureShell("Sites");
});
}
```

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.
We currently use XUnit to do unit testing.

###Contributing

Expand Down

0 comments on commit 14ad173

Please sign in to comment.