You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 10/umbraco-cms/fundamentals/setup/install/install-umbraco-with-templates.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Video tutorial
12
12
13
13
1. Install the latest [.NET SDK](https://dotnet.microsoft.com/download).
14
14
2. Run `dotnet new install Umbraco.Templates` to install the project templates.\
15
-
_The solution is packaged up into the NuGet package_[_Umbraco.Templates_](https://www.nuget.org/packages/Umbraco.Templates)_and can be installed into the dotnet CLI_.
15
+
&#xNAN;_The solution is packaged up into the NuGet package_[_Umbraco.Templates_](https://www.nuget.org/packages/Umbraco.Templates)_and can be installed into the dotnet CLI_.
16
16
17
17
> Once that is complete, you can see that Umbraco was added to the list of available projects types by running `dotnet new --list`:
Copy file name to clipboardExpand all lines: 10/umbraco-cms/fundamentals/setup/server-setup/running-umbraco-in-docker.md
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,33 +4,32 @@ Exactly how you choose to compose your Dockerfile will depend on your project sp
4
4
5
5
## What is Docker
6
6
7
-
Docker is a platform for developing, shipping, and running applications in containers. Multiple services exist for hosting these containers. For more information, refer to the [official Docker Documentation](https://docs.docker.com/)
7
+
Docker is a platform for developing, shipping, and running applications in containers. Multiple services exist for hosting these containers. For more information, refer to the [official Docker Documentation](https://docs.docker.com/)
8
8
9
9
## The Docker file system
10
10
11
-
By default, files created inside a container are written to an ephemeral, writable container layer.
11
+
By default, files created inside a container are written to an ephemeral, writable container layer.\
12
12
This means that the files don't persist when the container is removed, and it's challenging to get files out of the container. Additionally, this writable layer is not suitable for performance-critical data processing.
13
13
14
14
This has implications when running Umbraco in Docker.
15
15
16
16
For more information, refer to the [Docker documentation on storage](https://docs.docker.com/engine/storage/).
17
17
18
-
### General file system consideration
18
+
### General file system consideration
19
19
20
20
In general, when working with files and Docker you work in a "push" fashion with read-only layers. When you build, you take all your files and "push" them into this read-only layer.
21
21
22
22
This means that you should avoid making files on the fly, and instead rely on building your image.
23
23
24
-
In an Umbraco context, this means you should not create or edit template, script or stylesheet files via the backoffice. These should be deployed as part of your web application and not managed via Umbraco.
24
+
In an Umbraco context, this means you should not create or edit template, script or stylesheet files via the backoffice. These should be deployed as part of your web application and not managed via Umbraco.
25
25
26
26
Similarly, you shouldn't use InMemory modelsbuilder, since that also relies on creating files on the disk. While this is not a hard requirement, it doesn't provide any value unless you are live editing your site.
27
27
28
28
Instead, configure models builder to use "source code" mode in development, and "none" in production, as [described when using runtime modes](https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/runtime-modes).
29
29
30
-
31
30
### Logs
32
31
33
-
Umbraco writes logs to the `/umbraco/Logs/` directory. Due to the performance implications of writing to a writable layer,
32
+
Umbraco writes logs to the `/umbraco/Logs/` directory. Due to the performance implications of writing to a writable layer,\
34
33
and the limited size, it is recommended to mount a volume to this directory.
35
34
36
35
### Data
@@ -39,18 +38,18 @@ The `/umbraco/Data/` directory is used to store temporary files, such as file up
39
38
40
39
### Media
41
40
42
-
It's recommended to not store media in the writable layer. This is for similar performance reasons as logs,
43
-
but also for practical hosting reasons. You likely want to persist media files between containers.
41
+
It's recommended to not store media in the writable layer. This is for similar performance reasons as logs,\
42
+
but also for practical hosting reasons. You likely want to persist media files between containers.
44
43
45
44
One solution is to use bind mounts. The ideal setup, though, is to store the media and ImageSharp cache externally. For more information, refer to the [Azure Blob Storage documentation](https://docs.umbraco.com/umbraco-cms/extending/filesystemproviders/azure-blob-storage).
46
45
47
46
### Required files
48
47
49
-
Your solution may require some specific files to run, such as license files. You will need to pass these files into the container at build time, or mount them externally.
48
+
Your solution may require some specific files to run, such as license files. You will need to pass these files into the container at build time, or mount them externally.
50
49
51
50
## HTTPS
52
51
53
-
When running websites in Docker, it's common to do so behind a reverse proxy or load balancer.
52
+
When running websites in Docker, it's common to do so behind a reverse proxy or load balancer.\
54
53
In these scenarios you will likely handle SSL termination at the reverse proxy. This means that Umbraco will not be aware of the SSL termination, and will complain about not using HTTPS.
55
54
56
55
Umbraco checks for HTTPS in two locations:
@@ -85,7 +84,7 @@ The `UseHttpsValidator` must be removed through code For more information see th
85
84
86
85
The code to remove the validator can look something like:
87
86
88
-
```C#
87
+
```c#
89
88
using Umbraco.Cms.Core.Composing;
90
89
using Umbraco.Cms.Infrastructure.Runtime.RuntimeModeValidators;
Copy file name to clipboardExpand all lines: 10/umbraco-cms/fundamentals/setup/upgrading/version-specific/migrate-content-to-umbraco-8.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ A content migration tool has been implemented in Umbraco 8.1.0, to help you with
13
13
In this guide you can read more about the tool, its limitations, and how to use it in practice.
14
14
15
15
{% hint style="info" %}
16
-
#### Migrating Umbraco Cloud sites
16
+
**Migrating Umbraco Cloud sites**
17
17
18
18
Follow the [steps outlined in the Umbraco Cloud documentation](../../../../../umbraco-cloud/upgrades/migrate-from-umbraco-7-to-8.md) to upgrade your Umbraco 7 site on Cloud.
19
19
{% endhint %}
@@ -71,9 +71,9 @@ There are 3 options that a developer can choose to do to work around this automa
71
71
72
72
This option requires you to create a custom C# migrator for each of your custom property editors that store custom configuration data. It will also require that you implement these migrators before you run the Umbraco 8 content migration.
73
73
74
-
To do this, you will create an implementation of `IPreValueMigrator` or inherit from the base class [`DefaultPreValueMigrator`](https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/src/Umbraco.Core/Migrations/Upgrade/V\_8\_0\_0/DataTypes/DefaultPreValueMigrator.cs).
74
+
To do this, you will create an implementation of `IPreValueMigrator` or inherit from the base class [`DefaultPreValueMigrator`](https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/DefaultPreValueMigrator.cs).
75
75
76
-
There are plenty of examples of this in the [Umbraco-CMS codebase](https://github.com/umbraco/Umbraco-CMS/tree/v8/dev/src/Umbraco.Core/Migrations/Upgrade/V\_8\_0\_0/DataTypes).
76
+
There are plenty of examples of this in the [Umbraco-CMS codebase](https://github.com/umbraco/Umbraco-CMS/tree/v8/dev/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes).
77
77
78
78
You will then need to register them in a composer:
79
79
@@ -131,7 +131,7 @@ The site in this example is an Umbraco 7.13.1 site, and we will use Nuget to upd
131
131
132
132
Following the [general upgrade instructions](../) we will now upgrade via Nuget until we get to this point:
133
133
134
-
 (1) (1) (1).png>)
134
+
 (1) (1) (1).png>)
135
135
136
136
{% hint style="warning" %}
137
137
When upgrading an old website, check if you are using obsolete properties in your Data Types. These should be changed to their updated counterparts. The migration **will fail if you are still using obsolete properties.**
@@ -156,7 +156,7 @@ Once it is upgraded and you have verified everything is working, move on to the
156
156
157
157
The first thing to do is to spin up a fresh new Umbraco 8.1+ site. Make sure everything works and that no content is there.
If you have customized the `UsersMembershipProvider` on your Umbraco 7 site you need to copy that over to the 8.1 `web.config` as well. Additionally you need to update the `type` attribute to be `type="Umbraco.Web.Security.Providers.UsersMembershipProvider, Umbraco.Web"`.
@@ -174,11 +174,11 @@ The version will be set to 8.1.0, and you need to change it to the version you a
174
174
175
175
When you start the site it will ask you to login and then show you this screen:
176
176
177
-
 (1).png>)
177
+
 (1) (1).png>)
178
178
179
179
From here, the automatic migration will take over, and after a little bit you can log in and see your content:
180
180
181
-
 (1) (1).png>)
181
+
 (1) (1).png>)
182
182
183
183
{% hint style="info" %}
184
184
Please be aware that this is a **content migration**. If you go to the frontend after following these steps, it will throw errors.
Copy file name to clipboardExpand all lines: 10/umbraco-cms/reference/using-ioc.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,15 @@
1
1
---
2
-
3
-
4
-
meta.Title: "Umbraco Dependency Injection"
5
-
description: "Inversion of Control/Dependency Injection in Umbraco"
2
+
meta.Title: Umbraco Dependency Injection
3
+
description: Inversion of Control/Dependency Injection in Umbraco
6
4
---
7
5
8
6
# Inversion of Control / Dependency injection
9
7
10
8
Umbraco v9+ supports dependency injection out of the box. Umbraco uses the [ASP.NET Core built-in dependency injection](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0#service-lifetimes). This means that you don't have to install external packages to register and use your dependencies. If you're familiar with ASP.NET Core, the experience will be similar.
11
9
12
-
`IUmbracoBuilder` is a Umbraco-specific abstraction on top of the `IServiceCollection`, its purpose is to aid in adding and replacing Umbraco-specific services, such as notification handlers, filesystems, server role accessor, and so on. You can access the `IServiceCollection` directly to add your custom services through the `Services` property, see below for a concrete example:
10
+
`IUmbracoBuilder` is a Umbraco-specific abstraction on top of the `IServiceCollection`, its purpose is to aid in adding and replacing Umbraco-specific services, such as notification handlers, filesystems, server role accessor, and so on. You can access the `IServiceCollection` directly to add your custom services through the `Services` property, see below for a concrete example:
13
11
14
-
```C#
12
+
```c#
15
13
IUmbracoBuilder.Services
16
14
```
17
15
@@ -23,7 +21,7 @@ There are two strategies for registering your own dependencies to the container,
23
21
24
22
When working with your site, and not a package, the recommended way to register dependencies is with the `ConfigureServices` method of the `Startup` class in `Startup.cs`:
@@ -41,7 +39,7 @@ public void ConfigureServices(IServiceCollection services)
41
39
42
40
### Registering dependencies in packages
43
41
44
-
When working with packages, you won't have access to the `Startup.cs` file, so instead you must use a [composer](../implementation/composing.md) to register your own dependencies in the container, using the `Services` property, or appropriate extension method, of the `IUmbracoBuilder`:
42
+
When working with packages, you won't have access to the `Startup.cs` file, so instead you must use a [composer](../implementation/composing.md) to register your own dependencies in the container, using the `Services` property, or appropriate extension method, of the `IUmbracoBuilder`:
45
43
46
44
```csharp
47
45
usingIOCDocs.NotificationHandlers;
@@ -65,14 +63,14 @@ namespace IOCDocs
65
63
```
66
64
67
65
{% hint style="info" %}
68
-
Remember to add `Umbraco.Cms.Core.DependencyInjection` and `Microsoft.Extensions.DependencyInjection` as 'using' statements where you register your services, to gain access to the `IUmbracoBuilder`, its extension methods, and the Microsoft `IServiceProvider.
66
+
Remember to add `Umbraco.Cms.Core.DependencyInjection` and `Microsoft.Extensions.DependencyInjection` as 'using' statements where you register your services, to gain access to the `IUmbracoBuilder`, its extension methods, and the Microsoft \`IServiceProvider.
69
67
{% endhint %}
70
68
71
69
### Builder extension methods
72
70
73
71
Depending on your scenario, you may have a lot of dependencies you need to register, in this case, your `Startup.cs` or Composer might become cluttered and hard to manage. A great way to manage multiple services is by creating your own custom extension methods for the `IUmbracoBuilder`, this way you can group similar dependencies in extension methods and register them all in as little as a single call:
74
72
75
-
```C#
73
+
```c#
76
74
usingIOCDocs.NotificationHandlers;
77
75
usingIOCDocs.Services;
78
76
usingMicrosoft.Extensions.DependencyInjection;
@@ -109,14 +107,15 @@ namespace IOCDocs
109
107
110
108
{% hint style="info" %}
111
109
It is not required to have an interface for your dependency:
110
+
112
111
```csharp
113
112
services.AddSingleton<Foobar>();
114
113
```
115
114
{% endhint %}
116
115
117
116
Now you can call your `AddCustomServices` in either the `Startup.cs` file, or your composer like so:
* A new instance will be created each time it's injected.
161
+
* A new instance will be created each time it's injected.
163
162
* Scoped - one unique instance per web request (connection)
164
163
* Scoped services are disposed at the end of the request
165
164
* Be very careful not to resolve a scoped service from a singleton, since it may cause it to have an incorrect state in subsequent requests.
@@ -214,7 +213,7 @@ namespace IOCDocs.Services
214
213
215
214
### Injecting dependencies into a View or Template
216
215
217
-
You might need to use services within your templates or views, fortunately, you can inject services directly into your views using the `@inject` keyword. You can for example inject the `Foobar` from above into a view like so:
216
+
You might need to use services within your templates or views, fortunately, you can inject services directly into your views using the `@inject` keyword. You can for example inject the `Foobar` from above into a view like so:
218
217
219
218
```html
220
219
@using Umbraco.Cms.Web.Common.PublishedModels;
@@ -243,7 +242,7 @@ Most of (if not all) the Umbraco goodies you work with every day can be injected
243
242
244
243
### UmbracoHelper
245
244
246
-
[Read more about the UmbracoHelper](../reference/querying/umbracohelper.md)
245
+
[Read more about the UmbracoHelper](querying/umbracohelper.md)
247
246
248
247
`UmbracoHelper` is a scoped service, therefore you can only use it in services that are also scoped, or transient. To get UmbracoHelper you must inject `IUmbracoHelperAccessor` and use that to resolve it:
249
248
@@ -280,13 +279,14 @@ namespace IOCDocs.Services
280
279
}
281
280
}
282
281
```
282
+
283
283
{% hint style="info" %}
284
-
The use of the UmbracoHelper is only possible when there's an instance of the UmbracoContext. [You can read more here](../implementation/services).
284
+
The use of the UmbracoHelper is only possible when there's an instance of the UmbracoContext. [You can read more here](../implementation/services/).
285
285
{% endhint %}
286
286
287
287
### ExamineManager
288
288
289
-
[Read more about examine](../reference/searching/examine).
289
+
[Read more about examine](searching/examine/).
290
290
291
291
```csharp
292
292
usingSystem;
@@ -365,4 +365,4 @@ namespace IOCDocs.Services
365
365
366
366
## Using DI in Services and Helpers
367
367
368
-
[Services and Helpers](../implementation/services) - For more examples of using DI and gaining access to Services and Helpers, and creating your own custom Services and Helpers to inject.
368
+
[Services and Helpers](../implementation/services/) - For more examples of using DI and gaining access to Services and Helpers, and creating your own custom Services and Helpers to inject.
0 commit comments