> If you haven't installed it yet, you should install the [ABP CLI](https://docs.abp.io/en/abp/latest/CLI).
> If you haven't installed it yet, you should install the [ABP CLI](https://docs.abp.io/en/abp/latest/CLI).
In the same folder build the project with the following command on the cli.
After restoring the project will download the NuGet packages.
````shell
dotnet build /graphbuild
````
It will restore the project and download the NuGet packages.
Now you should run the DbMigrator project to up your database.
Now your project is ready you can run it properly.

Now you should run the DbMigrator project to up your database and your project is ready for running.
From now on, we will add some files to show the case to you.
From now on, we will add some files to show the case to you.
### Create application service interface
### Create application service interface
You should open your web application then find `Pages` folder and create a new folder under it named `Books`.
Define an interface for the application service. Create an `IBookAppService` interface in the `Books` folder (namespace) of the `Acme.BookStore.Application.Contracts` project:
You should create a new razor page and a new js file as named index.
Change the Pages/Books/Index.cshtml as the following:
Assume that we have an `IBookAppService` interface:
````csharp
````csharp
using System.Threading.Tasks;
using System.Threading.Tasks;
@ -109,7 +43,7 @@ namespace Acme.BookStore.Books
}
}
````
````
That uses a `BookDto` defined as shown:
Create a `Books` folder (namespace) in the `Acme.BookStore.Application.Contracts` project and add a `BookDto` class inside it:
```csharp
```csharp
using System;
using System;
@ -130,6 +64,9 @@ namespace Acme.BookStore.Books
}
}
```
```
# Implement the application service
It is time to implement the `IBookAppService` interface. Create a new class, named `BookAppService` in the `Books` namespace (folder) of the `Acme.BookStore.Application` project:
It simply returns a list of books. You probably want to get the books from a database, but it doesn't matter for this article. To do it you can visit [here] (https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&DB=EF)
It simply returns a list of books. You probably want to get the books from a database, but it doesn't matter for this article. To do it you can visit [here] (https://docs.abp.io/en/abp/latest/Tutorials/Part-1?UI=MVC&DB=EF)
### Consume the app service from the console application
### Consume the app service from the console application
Add a new test class, named BookAppService_Tests in the Application.Tests
Change `ClientDemoService` as shown the following in the `Acme.BookStore.HttpApi.Client.ConsoleTestApp` project under the test folder.
> Books: Anna Karenina, Crime and Punishment, Mother
### Convert application to use static client proxies
### Convert application to use static client proxies
Before showing you how to use static client proxies instead of dynamic client proxies, I ask you to talk differences between both approaches. Their similarities, advantages and disadvantages to each other.
Before showing you how to use static client proxies instead of dynamic client proxies, I ask you to talk differences between both approaches. Their similarities, advantages and disadvantages to each other.
@ -211,22 +149,21 @@ Firstly add Volo.Abp.Http.Client NuGet package to your client project:
````shell
````shell
Install-Package Volo.Abp.Http.Client
Install-Package Volo.Abp.Http.Client
````
````
Then add AbpHttpClientModule dependency to your module:
```csharp
[DependsOn(
typeof(AbpHttpClientModule)
//the other dependencies
)]
public class BookStoreApplicationModule : AbpModule
> The [application startup template](https://docs.abp.io/en/abp/latest/Startup-Templates/Application) comes pre-configured for the **dynamic** client proxy generation, in the `HttpApi.Client` project. If you want to switch to the **static** client proxies, change `context.Services.AddHttpClientProxies` to `context.Services.AddStaticHttpClientProxies` in the module class of your `HttpApi.Client` project.
```csharp
public class BookStoreHttpApiClientModule : AbpModule
{
{
public const string RemoteServiceName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
@ -234,7 +171,6 @@ public class BookStoreApplicationModule : AbpModule
`AddStaticHttpClientProxies` method gets an assembly, finds all service interfaces in the given assembly, and prepares for static client proxy generation.
`AddStaticHttpClientProxies` method gets an assembly, finds all service interfaces in the given assembly, and prepares for static client proxy generation.
> The [application startup template](https://docs.abp.io/en/abp/latest/Startup-Templates/Application) comes pre-configured for the **dynamic** client proxy generation, in the `HttpApi.Client` project. If you want to switch to the **static** client proxies, change `context.Services.AddHttpClientProxies` to `context.Services.AddStaticHttpClientProxies` in the module class of your `HttpApi.Client` project.
Now you're ready to generate the client proxy code by running the following command in the root folder of your client project when your project is running.
Now you're ready to generate the client proxy code by running the following command in the root folder of your client project when your project is running.
@ -242,12 +178,11 @@ Now you're ready to generate the client proxy code by running the following comm
After completing that you can make the localization configuration and you should give permission at the Admin UI side. Now you should the following screen.
After completing that you can make the localization configuration and you should give permission at the Admin UI side. You can see the same output again and all will be alright.

### Further Reading
### Further Reading
In this small tutorial, I explained how you can create an example project and apply static client proxy instead of dynamic client proxy. Also summarized the differences between both approaches.
In this small tutorial, I explained how you can create an example project and apply static client proxy instead of dynamic client proxy. Also summarized the differences between both approaches.