From 8c966c08296379d6352d13a3386f95f28bf006ca Mon Sep 17 00:00:00 2001 From: Xeevis Date: Sun, 30 Jun 2019 00:32:21 +0200 Subject: [PATCH 1/3] Update Contribution/Index.md --- docs/cs/Contribution/Index.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/cs/Contribution/Index.md b/docs/cs/Contribution/Index.md index 667dac84b6..3716d8dc76 100644 --- a/docs/cs/Contribution/Index.md +++ b/docs/cs/Contribution/Index.md @@ -29,6 +29,14 @@ Pokud chcete přeložit celou [dokumentaci](https://abp.io/documents/) (včetně * Pro referenci použijte ["en" složku](https://github.com/abpframework/abp/tree/master/docs/en) a její názvy souborů a strom složek. Při překladu této dokumentace zachovejte prosím tyto názvy stejné. * Zašlete pull request (PR) po překladu jakéhokoliv dokumentu klidně i po jednom. Nečekejte až budete mít překlad všech dokumentů. +Existuje několik základních dokumentů, které je třeba přeložit než bude jazyk uveřejněn na [stránkách ABP dokumentace](https://docs.abp.io) + +* Začínáme dokumenty +* Tutoriály +* CLI + +Nový jazyk je publikován jakmile budou minimálně tyto překlady dokončeny. + ### Lokalizace zdrojů ABP framework má flexibilní [lokalizační systém](../Localization.md). Můžete tak vytvořit lokalizované uživatelské prostředí pro svou vlastní aplikaci. From ed98b55e112a04a92cdd855698322df13a86e26d Mon Sep 17 00:00:00 2001 From: Xeevis Date: Sun, 30 Jun 2019 00:32:45 +0200 Subject: [PATCH 2/3] Copy Getting-Started docs --- .../Getting-Started-AspNetCore-Application.md | 186 ++++++++++++++++++ ...Getting-Started-AspNetCore-MVC-Template.md | 102 ++++++++++ .../cs/Getting-Started-Console-Application.md | 181 +++++++++++++++++ 3 files changed, 469 insertions(+) create mode 100644 docs/cs/Getting-Started-AspNetCore-Application.md create mode 100644 docs/cs/Getting-Started-AspNetCore-MVC-Template.md create mode 100644 docs/cs/Getting-Started-Console-Application.md diff --git a/docs/cs/Getting-Started-AspNetCore-Application.md b/docs/cs/Getting-Started-AspNetCore-Application.md new file mode 100644 index 0000000000..9f06897895 --- /dev/null +++ b/docs/cs/Getting-Started-AspNetCore-Application.md @@ -0,0 +1,186 @@ +# Getting Started ABP With AspNet Core MVC Web Application + +This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with the **[startup template](Getting-Started-AspNetCore-MVC-Template.md)**. + +## Create A New Project + +1. Create a new empty AspNet Core Web Application from Visual Studio: + +![](images/create-new-aspnet-core-application.png) + +2. Select Empty Template + +![](images/select-empty-web-application.png) + +You could select another template, but I want to show it from a clear project. + +## Install Volo.Abp.AspNetCore.Mvc Package + +Volo.Abp.AspNetCore.Mvc is AspNet Core MVC integration package for ABP. So, install it to your project: + +```` +Install-Package Volo.Abp.AspNetCore.Mvc +```` + +## Create First ABP Module + +ABP is a modular framework and it requires a **startup (root) module** class derived from ``AbpModule``: + +````C# +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.AspNetCore.Modularity; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Modularity; + +namespace BasicAspNetCoreApplication +{ + [DependsOn(typeof(AbpAspNetCoreMvcModule))] + public class AppModule : AbpModule + { + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var app = context.GetApplicationBuilder(); + var env = context.GetEnvironment(); + + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseMvcWithDefaultRoute(); + } + } +} +```` + +``AppModule`` is a good name for the startup module for an application. + +ABP packages define module classes and a module can depend on another module. In the code above, our ``AppModule`` depends on ``AbpAspNetCoreMvcModule`` (defined by Volo.Abp.AspNetCore.Mvc package). It's common to add a ``DependsOn`` attribute after installing a new ABP nuget package. + +Instead of Startup class, we are configuring ASP.NET Core pipeline in this module class. + +## The Startup Class + +Next step is to modify Startup class to integrate to ABP module system: + +````C# +using System; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; + +namespace BasicAspNetCoreApplication +{ + public class Startup + { + public IServiceProvider ConfigureServices(IServiceCollection services) + { + services.AddApplication(); + + return services.BuildServiceProviderFromFactory(); + } + + public void Configure(IApplicationBuilder app) + { + app.InitializeApplication(); + } + } +} + +```` + +Changed ``ConfigureServices`` method to return ``IServiceProvider`` instead of ``void``. This change allows us to replace AspNet Core's Dependency Injection with another framework (see Autofac integration section below). ``services.AddApplication()`` adds all services defined in all modules beginning from the ``AppModule``. + +``app.InitializeApplication()`` call in ``Configure`` method initializes and starts the application. + +## Hello World! + +The application above does nothing. Let's create an MVC controller does something: + +````C# +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; + +namespace BasicAspNetCoreApplication.Controllers +{ + public class HomeController : AbpController + { + public IActionResult Index() + { + return Content("Hello World!"); + } + } +} + +```` + +If you run the application, you will see a "Hello World!" message on the page. + +Derived ``HomeController`` from ``AbpController`` instead of standard ``Controller`` class. This is not required, but ``AbpController`` class has useful base properties and methods to make your development easier. + +## Using Autofac as the Dependency Injection Framework + +While AspNet Core's Dependency Injection (DI) system is fine for basic requirements, Autofac provides advanced features like Property Injection and Method Interception which are required by ABP to perform advanced application framework features. + +Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty easy. + +1. Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) package + +```` +Install-Package Volo.Abp.Autofac +```` + +2. Add ``AbpAutofacModule`` Dependency + +````C# +[DependsOn(typeof(AbpAspNetCoreMvcModule))] +[DependsOn(typeof(AbpAutofacModule))] //Add dependency to ABP Autofac module +public class AppModule : AbpModule +{ + ... +} +```` + +3. Change ``services.AddApplication();`` line in the ``Startup`` class as shown below: + +````C# +services.AddApplication(options => +{ + options.UseAutofac(); //Integrate to Autofac +}); +```` + +4. Update `Program.cs` to not use the `WebHost.CreateDefaultBuilder()` method since it uses the default DI container: + +````csharp +public class Program +{ + public static void Main(string[] args) + { + /* + https://github.com/aspnet/AspNetCore/issues/4206#issuecomment-445612167 + CurrentDirectoryHelpers exists in: \framework\src\Volo.Abp.AspNetCore.Mvc\Microsoft\AspNetCore\InProcess\CurrentDirectoryHelpers.cs + Will remove CurrentDirectoryHelpers.cs when upgrade to ASP.NET Core 3.0. + */ + CurrentDirectoryHelpers.SetCurrentDirectory(); + + BuildWebHostInternal(args).Run(); + } + + public static IWebHost BuildWebHostInternal(string[] args) => + new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIIS() + .UseIISIntegration() + .UseStartup() + .Build(); +} +```` + +## Source Code + +Get source code of the sample project created in this tutorial from [here](https://github.com/abpframework/abp/tree/master/samples/BasicAspNetCoreApplication). + diff --git a/docs/cs/Getting-Started-AspNetCore-MVC-Template.md b/docs/cs/Getting-Started-AspNetCore-MVC-Template.md new file mode 100644 index 0000000000..1e61e96614 --- /dev/null +++ b/docs/cs/Getting-Started-AspNetCore-MVC-Template.md @@ -0,0 +1,102 @@ +## Getting Started With the ASP.NET Core MVC Template + +This tutorials explains how to create a new ASP.NET Core MVC web application using the startup template, configure and run it. + +### Creating a New Project + +This tutorial uses **ABP CLI** to create a new project. See the [Get Started](https://abp.io/get-started) page for other options. + +Install the ABP CLI using a command line window, if you've not installed before: + +````bash +dotnet tool install -g Volo.Abp.Cli +```` + +Use `abp new` command in an empty folder to create your project: + +````bash +abp new Acme.BookStore +```` + +> You can use different level of namespaces; e.g. BookStore, Acme.BookStore or Acme.Retail.BookStore. + +`new` command creates a **layered MVC application** with **Entity Framework Core** as the database provider. However, it has additional options. See the [CLI documentation](CLI.md) for all available options. + +#### Pre Requirements + +The created solution requires; + +* [Visual Studio 2017 (v15.9.0+)](https://visualstudio.microsoft.com/tr/downloads/) +* [.NET Core 2.2+](https://www.microsoft.com/net/download/dotnet-core/) + +### The Solution Structure + +Open the solution in **Visual Studio**: + +![bookstore-visual-studio-solution](images/bookstore-visual-studio-solution-v3.png) + +The solution has a layered structure (based on [Domain Driven Design](Domain-Driven-Design.md)) and contains unit & integration test projects properly configured to work with **EF Core** & **SQLite in-memory** database. + +> See [MVC application template document](Startup-Templates/Mvc.md) to understand the solution structure in details. + +### Database Connection String + +Check the **connection string** in the `appsettings.json` file under the `.Web` project: + +````json +{ + "ConnectionStrings": { + "Default": "Server=localhost;Database=BookStore;Trusted_Connection=True" + } +} +```` + +The solution is configured to use **Entity Framework Core** with **MS SQL Server**. EF Core supports [various](https://docs.microsoft.com/en-us/ef/core/providers/) database providers, so you can use another DBMS if you want. Change the connection string if you need. + +### Create Database & Apply Database Migrations + +You have two options to create the database. + +#### Using the DbMigrator Application + +The solution contains a console application (named `Acme.BookStore.DbMigrator` in this sample) that can create database, apply migrations and seed initial data. It is useful on development as well as on production environment. + +> `.DbMigrator` project has its own `appsettings.json`. So, if you have changed the connection string above, you should also change this one. + +Right click to the `.DbMigrator` project and select **Set as StartUp Project**: + +![set-as-startup-project](images/set-as-startup-project.png) + +Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown below: + +![set-as-startup-project](images/db-migrator-app.png) + +#### Using EF Core Update-Database Command + +Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. Right click to the `.Web` project and select **Set as StartUp Project**: + +![set-as-startup-project](images/set-as-startup-project.png) + +Open the **Package Manager Console**, select `.EntityFrameworkCore.DbMigrations` project as the **Default Project** and run the `Update-Database` command: + +![pcm-update-database](images/pcm-update-database-v2.png) + +This will create a new database based on the configured connection string. + +> Using the `.Migrator` tool is the suggested way, because it also seeds the initial data to be able to properly run the web application. + +### Running the Application + +Ensure that the `.Web` project is the startup project. Run the application which will open the **home** page in your browser: + +![bookstore-homepage](images/bookstore-homepage.png) + +Click the **Login** button, enter `admin` as the username and `1q2w3E*` as the password to login to the application. + +The startup template includes the **identity management** and **tenant management** modules. Once you login, the Administration menu will be available where you can manage **tenants**, **roles**, **users** and their **permissions**. User management page is shown below: + +![bookstore-user-management](images/bookstore-user-management-v2.png) + +### What's Next? + +* [Application development tutorial](Tutorials/AspNetCore-Mvc/Part-I.md) diff --git a/docs/cs/Getting-Started-Console-Application.md b/docs/cs/Getting-Started-Console-Application.md new file mode 100644 index 0000000000..faaa8cd376 --- /dev/null +++ b/docs/cs/Getting-Started-Console-Application.md @@ -0,0 +1,181 @@ +# Getting Started ABP With Console Application + +This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a **[startup template](https://abp.io/Templates)**. + +## Create A New Project + +Create a new Regular .Net Core Console Application from Visual Studio: + +![](images/create-new-net-core-console-application.png) + +## Install Volo.Abp Package + +Volo.Abp.Core is the core nuget package to create ABP based applications. So, install it to your project: + +```` +Install-Package Volo.Abp.Core +```` + +## Create First ABP Module + +ABP is a modular framework and it requires a **startup (root) module** class derived from ``AbpModule``: + +````C# +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; + +namespace AbpConsoleDemo +{ + public class AppModule : AbpModule + { + + } +} +```` + +``AppModule`` is a good name for the startup module for an application. + +## Initialize The Application + +The next step is to bootstrap the application using the startup module created above: + +````C# +using System; +using Volo.Abp; + +namespace AbpConsoleDemo +{ + class Program + { + static void Main(string[] args) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + Console.WriteLine("Press ENTER to stop application..."); + Console.ReadLine(); + } + } + } +} + +```` + +``AbpApplicationFactory`` is used to create the application and load all modules taking ``AppModule`` as the startup module. ``Initialize()`` method starts the application. + +## Hello World! + +The application above does nothing. Let's create a service that does something: + +````C# +using System; +using Volo.Abp.DependencyInjection; + +namespace AbpConsoleDemo +{ + public class HelloWorldService : ITransientDependency + { + public void SayHello() + { + Console.WriteLine("Hello World!"); + } + } +} + +```` + +``ITransientDependency`` is a special interface of ABP that automatically registers the service as transient (see [dependency injection document](Dependency-Injection.md)). + +Now, we can resolve the ``HelloWorldService`` and say hello. Change the Program.cs as shown below: + +````C# +using System; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace AbpConsoleDemo +{ + class Program + { + static void Main(string[] args) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + //Resolve a service and use it + var helloWorldService = + application.ServiceProvider.GetService(); + helloWorldService.SayHello(); + + Console.WriteLine("Press ENTER to stop application..."); + Console.ReadLine(); + } + } + } +} +```` + +While it's enough for this simple code example, it's always suggested to create scopes in case of directly resolving dependencies from ``IServiceProvider`` (see the [Dependency Injection documentation](Dependency-Injection.md)). + +## Using Autofac as the Dependency Injection Framework + +While AspNet Core's Dependency Injection (DI) system is fine for basic requirements, Autofac provides advanced features like Property Injection and Method Interception which are required by ABP to perform advanced application framework features. + +Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty easy. + +1. Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) package + +``` +Install-Package Volo.Abp.Autofac +``` + +1. Add ``AbpAutofacModule`` Dependency + +```c# +[DependsOn(typeof(AbpAutofacModule))] //Add dependency to the AbpAutofacModule +public class AppModule : AbpModule +{ + +} +``` + +1. Change ``Program.cs`` file as shown below: + +```c# +using System; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace AbpConsoleDemo +{ + class Program + { + static void Main(string[] args) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); //Autofac integration + })) + { + application.Initialize(); + + //Resolve a service and use it + var helloWorldService = + application.ServiceProvider.GetService(); + helloWorldService.SayHello(); + + Console.WriteLine("Press ENTER to stop application..."); + Console.ReadLine(); + } + } + } +} +``` + +Just called `options.UseAutofac()` method in the `AbpApplicationFactory.Create` options. + +## Source Code + +Get source code of the sample project created in this tutorial from [here](https://github.com/abpframework/abp/tree/master/samples/BasicConsoleApplication). From 90cf40c5063b4a46d660b988b543d130c6421104 Mon Sep 17 00:00:00 2001 From: Xeevis Date: Sat, 13 Jul 2019 14:07:07 +0200 Subject: [PATCH 3/3] Translate Getting-Started docs --- .../Getting-Started-AspNetCore-Application.md | 64 ++++++++--------- ...Getting-Started-AspNetCore-MVC-Template.md | 70 +++++++++---------- .../cs/Getting-Started-Console-Application.md | 60 ++++++++-------- 3 files changed, 97 insertions(+), 97 deletions(-) diff --git a/docs/cs/Getting-Started-AspNetCore-Application.md b/docs/cs/Getting-Started-AspNetCore-Application.md index 9f06897895..ffb2f556c6 100644 --- a/docs/cs/Getting-Started-AspNetCore-Application.md +++ b/docs/cs/Getting-Started-AspNetCore-Application.md @@ -1,30 +1,30 @@ -# Getting Started ABP With AspNet Core MVC Web Application +# Začínáme s ASP.NET Core MVC aplikací -This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with the **[startup template](Getting-Started-AspNetCore-MVC-Template.md)**. +Tento tutoriál vysvětluje jak začít s ABP z ničeho s minimem závislostí. Obvykle chcete začít se **[startovací šablonou](https://abp.io/Templates)**. -## Create A New Project +## Tvorba nového projektu -1. Create a new empty AspNet Core Web Application from Visual Studio: +1. Vytvořte novou prázdnou AspNet Core Web aplikaci ve Visual Studio: ![](images/create-new-aspnet-core-application.png) -2. Select Empty Template +2. Zvolte prázdnou šablonu ![](images/select-empty-web-application.png) -You could select another template, but I want to show it from a clear project. +Můžete zvolit i jinou šablonu, ale pro demonstraci je lepší čístý projekt. -## Install Volo.Abp.AspNetCore.Mvc Package +## Instalace Volo.Abp.AspNetCore.Mvc balíku -Volo.Abp.AspNetCore.Mvc is AspNet Core MVC integration package for ABP. So, install it to your project: +Volo.Abp.AspNetCore.Mvc je AspNet Core MVC integrační balík pro ABP. Takže ho nainstalujeme do projektu: ```` Install-Package Volo.Abp.AspNetCore.Mvc ```` -## Create First ABP Module +## Tvorba prvního ABP modulu -ABP is a modular framework and it requires a **startup (root) module** class derived from ``AbpModule``: +ABP je modulární framework a proto vyžaduje **spouštěcí (kořenový) modul** což je třída dědící z ``AbpModule``: ````C# using Microsoft.AspNetCore.Builder; @@ -56,15 +56,15 @@ namespace BasicAspNetCoreApplication } ```` -``AppModule`` is a good name for the startup module for an application. +``AppModule`` je dobrý název pro spouštěcí modul aplikace. -ABP packages define module classes and a module can depend on another module. In the code above, our ``AppModule`` depends on ``AbpAspNetCoreMvcModule`` (defined by Volo.Abp.AspNetCore.Mvc package). It's common to add a ``DependsOn`` attribute after installing a new ABP nuget package. +ABP balíky definují modulové třídy a modul může mít závislost na jiný modul. V kódu výše, náš ``AppModule`` má závislost na ``AbpAspNetCoreMvcModule`` (definován v balíku Volo.Abp.AspNetCore.Mvc). Je běžné přidat ``DependsOn`` atribute po instalaci nového ABP NuGet balíku. -Instead of Startup class, we are configuring ASP.NET Core pipeline in this module class. +Místo třídy Startup, konfigurujeme ASP.NET Core pipeline v této modulové třídě. -## The Startup Class +## Třída Startup -Next step is to modify Startup class to integrate to ABP module system: +V dalším kroku upravíme Startup třídu k integraci ABP modulového systému: ````C# using System; @@ -91,13 +91,13 @@ namespace BasicAspNetCoreApplication ```` -Changed ``ConfigureServices`` method to return ``IServiceProvider`` instead of ``void``. This change allows us to replace AspNet Core's Dependency Injection with another framework (see Autofac integration section below). ``services.AddApplication()`` adds all services defined in all modules beginning from the ``AppModule``. +Změnili jsme metodu ``ConfigureServices`` aby vracela ``IServiceProvider`` místo ``void``. Tato změna nám dovoluje nahradit AspNet Core vkládání závislostí za jiný framework (více v sekci Autofac integrace níže). ``services.AddApplication()`` přidává všechny služby definované ve všech modulech počínaje ``AppModule``. -``app.InitializeApplication()`` call in ``Configure`` method initializes and starts the application. +Volání ``app.InitializeApplication()`` v metodě ``Configure`` inicializuje a spustí aplikaci. -## Hello World! +## Ahoj světe! -The application above does nothing. Let's create an MVC controller does something: +Aplikace výše zatím nic nedělá. Pojďme proto vytvořit MVC controller, který už něco dělá: ````C# using Microsoft.AspNetCore.Mvc; @@ -116,43 +116,43 @@ namespace BasicAspNetCoreApplication.Controllers ```` -If you run the application, you will see a "Hello World!" message on the page. +Jakmile spustíte aplikaci, uvidíte na stránce zprávu "Hello World!". -Derived ``HomeController`` from ``AbpController`` instead of standard ``Controller`` class. This is not required, but ``AbpController`` class has useful base properties and methods to make your development easier. +Odvození ``HomeController`` od ``AbpController`` místo standardní třídy ``Controller``. Toto není vyžadováno, ale třída ``AbpController`` má užitečné základní vlastnosti a metody, které usnadňují vývoj. -## Using Autofac as the Dependency Injection Framework +## Použití Autofac jako frameworku pro vkládání závislostí -While AspNet Core's Dependency Injection (DI) system is fine for basic requirements, Autofac provides advanced features like Property Injection and Method Interception which are required by ABP to perform advanced application framework features. +Ačkoliv je AspNet Core systém pro vkládání závíslostí (DI) skvělý pro základní požadavky, Autofac poskytuje pokročilé funkce jako injekce vlastností nebo záchyt metod, které jsou v ABP užity k provádění pokročilých funkcí frameworku. -Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty easy. +Nahrazení AspNet Core DI systému za Autofac a integrace s ABP je snadná. -1. Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) package +1. Nainstalujeme [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) balík ```` Install-Package Volo.Abp.Autofac ```` -2. Add ``AbpAutofacModule`` Dependency +2. Přidáme ``AbpAutofacModule`` závislost ````C# [DependsOn(typeof(AbpAspNetCoreMvcModule))] -[DependsOn(typeof(AbpAutofacModule))] //Add dependency to ABP Autofac module +[DependsOn(typeof(AbpAutofacModule))] // Přidá závislost na AbpAutofacModule public class AppModule : AbpModule { ... } ```` -3. Change ``services.AddApplication();`` line in the ``Startup`` class as shown below: +3. Změníme řádek ``services.AddApplication();`` v třídě ``Startup`` následovně: ````C# services.AddApplication(options => { - options.UseAutofac(); //Integrate to Autofac + options.UseAutofac(); // Integrace s Autofac }); ```` -4. Update `Program.cs` to not use the `WebHost.CreateDefaultBuilder()` method since it uses the default DI container: +4. Upravíme `Program.cs` aby nepoužíval metodu `WebHost.CreateDefaultBuilder()` jelikož ta používá výchozí DI kontejner: ````csharp public class Program @@ -180,7 +180,7 @@ public class Program } ```` -## Source Code +## Zdrojový kód -Get source code of the sample project created in this tutorial from [here](https://github.com/abpframework/abp/tree/master/samples/BasicAspNetCoreApplication). +Získejte zdrojový kód vzorového projektu vytvořeného v tomto tutoriálů [z tohoto odkazu](https://github.com/abpframework/abp/tree/master/samples/BasicAspNetCoreApplication). diff --git a/docs/cs/Getting-Started-AspNetCore-MVC-Template.md b/docs/cs/Getting-Started-AspNetCore-MVC-Template.md index 1e61e96614..953e99b9f2 100644 --- a/docs/cs/Getting-Started-AspNetCore-MVC-Template.md +++ b/docs/cs/Getting-Started-AspNetCore-MVC-Template.md @@ -1,47 +1,47 @@ -## Getting Started With the ASP.NET Core MVC Template +## Začínáme s ASP.NET Core MVC šablonou -This tutorials explains how to create a new ASP.NET Core MVC web application using the startup template, configure and run it. +Tento tutoriál vysvětluje, jak vytvořit novou ASP.NET Core MVC webovou aplikaci pomocí úvodní šablony, jak ji nakonfigurovat a spustit. -### Creating a New Project +### Tvorba nového projektu -This tutorial uses **ABP CLI** to create a new project. See the [Get Started](https://abp.io/get-started) page for other options. +Tento tutoriál používá k tvorbě nového projektu **ABP CLI**. Podívejte se na stránku [Začínáme](https://abp.io/get-started) pro více možností. -Install the ABP CLI using a command line window, if you've not installed before: +Pokud ještě nemáte ABP CLI nainstalováno, učiňte tak pomocí okna příkazového řádku: ````bash dotnet tool install -g Volo.Abp.Cli ```` -Use `abp new` command in an empty folder to create your project: +K tvorbě vašeho projektu použijte příkaz `abp new` v prázdné složce: ````bash abp new Acme.BookStore ```` -> You can use different level of namespaces; e.g. BookStore, Acme.BookStore or Acme.Retail.BookStore. +> Můžete použít různé úrovně jmenných prostorů; např. BookStore, Acme.BookStore nebo Acme.Retail.BookStore. -`new` command creates a **layered MVC application** with **Entity Framework Core** as the database provider. However, it has additional options. See the [CLI documentation](CLI.md) for all available options. +Příkaz `new` vytvoří **vrstvenou MVC aplikaci** s **Entity Framework Core** jako databázovým poskytovatelem. Jsou zde však i jiné možnosti. Podívejte se na [CLI dokumnentaci](CLI.md) pro všechny další možností. -#### Pre Requirements +#### Požadavky -The created solution requires; +Vytvořené řešení vyžaduje; * [Visual Studio 2017 (v15.9.0+)](https://visualstudio.microsoft.com/tr/downloads/) * [.NET Core 2.2+](https://www.microsoft.com/net/download/dotnet-core/) -### The Solution Structure +### Struktura řešení -Open the solution in **Visual Studio**: +Otevřete řešení ve **Visual Studio**: ![bookstore-visual-studio-solution](images/bookstore-visual-studio-solution-v3.png) -The solution has a layered structure (based on [Domain Driven Design](Domain-Driven-Design.md)) and contains unit & integration test projects properly configured to work with **EF Core** & **SQLite in-memory** database. +Řešení má vrstvenou strukturu (založenou na [Domain Driven Design](Domain-Driven-Design.md)) a obsahuje projekty jednotkovových a integračních testů předkonfigurované pro práci s **EF Core** & **SQLite in-memory** databází. -> See [MVC application template document](Startup-Templates/Mvc.md) to understand the solution structure in details. +> Podívejte se na [dokument šablony MVC aplikace](Startup-Templates/Mvc.md) k detailnímu pochopení struktury řešení. -### Database Connection String +### Connection string databáze -Check the **connection string** in the `appsettings.json` file under the `.Web` project: +Zkontrolujte **connection string** v souboru `appsettings.json` v projektu `.Web`: ````json { @@ -51,52 +51,52 @@ Check the **connection string** in the `appsettings.json` file under the `.Web` } ```` -The solution is configured to use **Entity Framework Core** with **MS SQL Server**. EF Core supports [various](https://docs.microsoft.com/en-us/ef/core/providers/) database providers, so you can use another DBMS if you want. Change the connection string if you need. +Řešení je nakonfigurováno k používání **Entity Framework Core** s **MS SQL Server**. EF Core podporuje [různé](https://docs.microsoft.com/en-us/ef/core/providers/) databázové poskytovatele, takže můžete použít i jiné DBMS. V případě potřeby změňte connection string. -### Create Database & Apply Database Migrations +### Tvorba databáze & aplikace databázových migrací -You have two options to create the database. +K vytvoření databáze máte dvě možnosti. -#### Using the DbMigrator Application +#### Použití DbMigrator aplikace -The solution contains a console application (named `Acme.BookStore.DbMigrator` in this sample) that can create database, apply migrations and seed initial data. It is useful on development as well as on production environment. +Řešení obsahuje konzolovou aplikaci (v tomto příkladu nazvanou `Acme.BookStore.DbMigrator`), která může vytvářet databáze, aplikovat migrace a vkládat seed data. Je užitečná jak pro vývojové, tak pro produkční prostředí. -> `.DbMigrator` project has its own `appsettings.json`. So, if you have changed the connection string above, you should also change this one. +> Projekt `.DbMigrator` má vlastní `appsettings.json`. Takže pokud jste změnili connection string uvedený výše, musíte změnit také tento. -Right click to the `.DbMigrator` project and select **Set as StartUp Project**: +Klikněte pravým na projekt `.DbMigrator` a vyberte **Set as StartUp Project**: ![set-as-startup-project](images/set-as-startup-project.png) -Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown below: +Zmáčkněte F5 (nebo Ctrl+F5) ke spuštění aplikace. Výstup bude vypadat následovně: ![set-as-startup-project](images/db-migrator-app.png) -#### Using EF Core Update-Database Command +#### Použití EF Core Update-Database příkazu -Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. Right click to the `.Web` project and select **Set as StartUp Project**: +Ef Core má `Update-Database` příkaz, který v případě potřeby vytvoří databázi a aplikuje čekající migrace. Klikněte pravým na projekt `.Web` a vyberte **Set as StartUp Project**: ![set-as-startup-project](images/set-as-startup-project.png) -Open the **Package Manager Console**, select `.EntityFrameworkCore.DbMigrations` project as the **Default Project** and run the `Update-Database` command: +Otevřete **Package Manager Console**, vyberte projekt `.EntityFrameworkCore.DbMigrations` jako **Default Project** and spusťte příkaz `Update-Database`: ![pcm-update-database](images/pcm-update-database-v2.png) -This will create a new database based on the configured connection string. +Dojde k vytvoření nové databáze na základě nakonfigurovaného connection stringu. -> Using the `.Migrator` tool is the suggested way, because it also seeds the initial data to be able to properly run the web application. +> Použití nástroje `.Migrator` je doporučený způsob, jelikož zároveň vloží seed data nutné k správnému běhu webové aplikace. -### Running the Application +### Spuštění aplikace -Ensure that the `.Web` project is the startup project. Run the application which will open the **home** page in your browser: +Ujistěte se že je projekt `.Web` nastaven jako startovací projekt. Spusťte aplikaci což následně otevře **úvodní** stránku ve vašem prohlížeči: ![bookstore-homepage](images/bookstore-homepage.png) -Click the **Login** button, enter `admin` as the username and `1q2w3E*` as the password to login to the application. +Klikněte na tlačítko **Přihlásit**, vložte `admin` jako uživatelské jméno a `1q2w3E*` jako heslo k přihlášení do aplikace. -The startup template includes the **identity management** and **tenant management** modules. Once you login, the Administration menu will be available where you can manage **tenants**, **roles**, **users** and their **permissions**. User management page is shown below: +Startovací šabloná obsahuje **identity management** a **tenant management** moduly. Jakmile se přihlásite, budete mít přístup do nabídky Administrace, kde můžete spravovat **tenanty**, **role**, **uživatele** a jejich **oprávnění**. Správa uživatelů vypadá takto: ![bookstore-user-management](images/bookstore-user-management-v2.png) -### What's Next? +### Co dále? -* [Application development tutorial](Tutorials/AspNetCore-Mvc/Part-I.md) +* [Tutoriál vývoje aplikace](Tutorials/AspNetCore-Mvc/Part-I.md) diff --git a/docs/cs/Getting-Started-Console-Application.md b/docs/cs/Getting-Started-Console-Application.md index faaa8cd376..bac35149ec 100644 --- a/docs/cs/Getting-Started-Console-Application.md +++ b/docs/cs/Getting-Started-Console-Application.md @@ -1,24 +1,24 @@ -# Getting Started ABP With Console Application +# Začínáme s konzolovou aplikací -This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a **[startup template](https://abp.io/Templates)**. +Tento tutoriál vysvětluje jak začít s ABP z ničeho s minimem závislostí. Obvykle chcete začít se **[startovací šablonou](https://abp.io/Templates)**. -## Create A New Project +## Tvorba nového projektu -Create a new Regular .Net Core Console Application from Visual Studio: +Vytvořte regulérní .NET Core konzolovou aplikaci z Visual Studio: ![](images/create-new-net-core-console-application.png) -## Install Volo.Abp Package +## Instalace Volo.Abp balíku -Volo.Abp.Core is the core nuget package to create ABP based applications. So, install it to your project: +Volo.Abp.Core je základní NuGet balík k tvorbě aplikací založených na ABP. Takže ho nainstalujeme do projektu: ```` Install-Package Volo.Abp.Core ```` -## Create First ABP Module +## Tvorba prvního ABP modulu -ABP is a modular framework and it requires a **startup (root) module** class derived from ``AbpModule``: +ABP je modulární framework a proto vyžaduje **spouštěcí (kořenový) modul** což je třída dědící z ``AbpModule``: ````C# using Microsoft.Extensions.DependencyInjection; @@ -33,11 +33,11 @@ namespace AbpConsoleDemo } ```` -``AppModule`` is a good name for the startup module for an application. +``AppModule`` je dobrý název pro spouštěcí modul aplikace. -## Initialize The Application +## Inicializace aplikace -The next step is to bootstrap the application using the startup module created above: +Dalším krokem je bootstrap aplikace pomocí spouštěcího modulu vytvořeného výše: ````C# using System; @@ -62,11 +62,11 @@ namespace AbpConsoleDemo ```` -``AbpApplicationFactory`` is used to create the application and load all modules taking ``AppModule`` as the startup module. ``Initialize()`` method starts the application. +``AbpApplicationFactory`` se používá k vytvoření aplikace a načtení všech modulů, s využitím ``AppModule`` jako spouštěcím modulem. ``Initialize()`` metoda spouští aplikaci. -## Hello World! +## Ahoj světe! -The application above does nothing. Let's create a service that does something: +Aplikace výše zatím nic nedělá. Pojďme proto vytvořit službu která už něco dělá: ````C# using System; @@ -85,9 +85,9 @@ namespace AbpConsoleDemo ```` -``ITransientDependency`` is a special interface of ABP that automatically registers the service as transient (see [dependency injection document](Dependency-Injection.md)). +``ITransientDependency`` je speciální rozhraní ABP, které automaticky registruje službu jako přechodnou (více v [dokumentu vkládání závislostí](Dependency-Injection.md)). -Now, we can resolve the ``HelloWorldService`` and say hello. Change the Program.cs as shown below: +Nyní můžeme vyřešit ``HelloWorldService`` a vypsat naše ahoj. Změníme Program.cs podle vyobrazení níže: ````C# using System; @@ -104,7 +104,7 @@ namespace AbpConsoleDemo { application.Initialize(); - //Resolve a service and use it + // Vyřeší službu a použije ji var helloWorldService = application.ServiceProvider.GetService(); helloWorldService.SayHello(); @@ -117,31 +117,31 @@ namespace AbpConsoleDemo } ```` -While it's enough for this simple code example, it's always suggested to create scopes in case of directly resolving dependencies from ``IServiceProvider`` (see the [Dependency Injection documentation](Dependency-Injection.md)). +I když je to dostačující pro tento jednoduchý príklad kódu, je vždy lepší v případě přímého řešení závislostí z ``IServiceProvider`` vytvořit rámce (více v [dokumentu vkládání závislostí](Dependency-Injection.md)). -## Using Autofac as the Dependency Injection Framework +## Využití Autofac jako frameworku pro vkládání závislostí -While AspNet Core's Dependency Injection (DI) system is fine for basic requirements, Autofac provides advanced features like Property Injection and Method Interception which are required by ABP to perform advanced application framework features. +Ačkoliv je AspNet Core systém pro vkládání závíslostí (DI) skvělý pro základní požadavky, Autofac poskytuje pokročilé funkce jako injekce vlastností nebo záchyt metod, které jsou v ABP užity k provádění pokročilých funkcí frameworku. -Replacing AspNet Core's DI system by Autofac and integrating to ABP is pretty easy. +Nahrazení AspNet Core DI systému za Autofac a integrace s ABP je snadná. -1. Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) package +1. Nainstalujeme [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) balík ``` Install-Package Volo.Abp.Autofac ``` -1. Add ``AbpAutofacModule`` Dependency +1. Přidáme ``AbpAutofacModule`` závislost ```c# -[DependsOn(typeof(AbpAutofacModule))] //Add dependency to the AbpAutofacModule +[DependsOn(typeof(AbpAutofacModule))] // Přidá závislost na AbpAutofacModule public class AppModule : AbpModule { } ``` -1. Change ``Program.cs`` file as shown below: +1. Změníme soubor ``Program.cs`` podle vyobrazení níže: ```c# using System; @@ -156,12 +156,12 @@ namespace AbpConsoleDemo { using (var application = AbpApplicationFactory.Create(options => { - options.UseAutofac(); //Autofac integration + options.UseAutofac(); // Autofac integrace })) { application.Initialize(); - //Resolve a service and use it + // Vyřeší službu a použije ji var helloWorldService = application.ServiceProvider.GetService(); helloWorldService.SayHello(); @@ -174,8 +174,8 @@ namespace AbpConsoleDemo } ``` -Just called `options.UseAutofac()` method in the `AbpApplicationFactory.Create` options. +Stačí volat metodu `options.UseAutofac()` v možnostech `AbpApplicationFactory.Create`. -## Source Code +## Zdrojový kód -Get source code of the sample project created in this tutorial from [here](https://github.com/abpframework/abp/tree/master/samples/BasicConsoleApplication). +Získejte zdrojový kód vzorového projektu vytvořeného v tomto tutoriálů [z tohoto odkazu](https://github.com/abpframework/abp/tree/master/samples/BasicConsoleApplication).