1. Hello World
In this tutorial, you will create a hello world service to have a quick feeling on how Gazel works.
Create a Hello World Service
To create a new business service, create a class named
Now add a new method called
TaskManager class as shown below.
public instance methods of classes within module projects are directly exposed as business services.
Gazel.Tutorial.Test.AppHost.Service project, and you will see a test page to be able to test your services.
On the left you will see that Gazel has rendered your
TaskManagement module and listed
TaskManager class as a service package, and under
Task Manager it lists your
SayHello method as a business service. Click
Say Hello and press
Call button to make a test service request. When you do, you will see a response saying
Writing a Unit Test
Now that you have implemented the most basic business service, it is time to test it.
Create a class named
Write below code within this class;
Context property comes from
TestBase which allows you to access IoC container. Manager classes are singleton by convention, so you can access to
TaskManager instance by
That's it. Now you can run this test to see if it succeeds.
Gazel uses NUnit for unit testing. For more information about NUnit see: NUnit Documentation
As you can see no configuration is needed to create a new service. Once you've created your solution and projects, every public class in module projects becomes a service package and every public method becomes a service by convention.
Now try to add new methods or add parameters, re-run and see the results.
Once you are ready, you can proceed to next page to create your first database operation using Gazel.
You can download complete source code for this tutorial here