Skip to content

Commit cbca219

Browse files
authored
Updates to documentation (#7574)
* ninject wording updates * update links in ninject * EF core wording changes * mysql scripts review and lint fixes
1 parent e119e84 commit cbca219

File tree

5 files changed

+27
-74
lines changed

5 files changed

+27
-74
lines changed
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Ninject
33
summary: Configure NServiceBus to use Ninject for dependency injection.
4-
reviewed: 2023-09-15
4+
reviewed: 2025-07-31
55
component: Ninject
66
related:
77
- samples/dependency-injection/ninject
@@ -14,31 +14,28 @@ include: container-deprecation-notice
1414

1515
NServiceBus can be configured to use [Ninject](http://www.ninject.org/) for dependency injection.
1616

17-
1817
### Default usage
1918

2019
snippet: Ninject
2120

22-
2321
### Using an existing kernel
2422

2523
snippet: Ninject_Existing
2624

27-
2825
### Unit of work
2926

30-
Its is possible to bind to use an _Unit of Work_ scope, which corresponds to the `DependencyLifecycle.InstancePerUnitOfWork` lifecycle, when registering components with `configuration.RegisterComponents(...)`.
27+
It is possible to bind to use an _Unit of Work_ scope, which corresponds to the `DependencyLifecycle.InstancePerUnitOfWork` lifecycle, when registering components with `configuration.RegisterComponents(...)`.
3128

3229
In essence, bindings using _Unit of Work_ scope
3330

34-
* will be instantiated only once per transport Message
35-
* will be disposed when message processing finishes
31+
- will be instantiated only once per transport Message
32+
- will be disposed when message processing finishes
3633

3734
Bind the services in _Unit of Work_ scope using:
3835

3936
snippet: NinjectUnitOfWork
4037

41-
Services using `InUnitOfWorkScope()` can only be injected into code which is processing messages. To inject the service somewhere else (e.g. because of an user interaction) define conditional bindings:
38+
Services using `InUnitOfWorkScope()` can only be injected into code which is processing messages. To inject the service somewhere else (e.g. because of a user interaction) define conditional bindings:
4239

4340
snippet: NinjectConditionalBindings
4441

@@ -48,18 +45,16 @@ snippet: NinjectContextPreservationFuncBinding
4845

4946
### Multi hosting
5047

51-
Multiple endpoints in a single process cannot share a single Ninject kernel. Each requires its own container instance or each requires its own child container. Ninject supports this with the [Ninject.Extensions.ChildKernel](https://github.com/ninject/Ninject.Extensions.ChildKernel) extension. Execute `new ChildKernel(parentKernel)` and pass this new kernel instance to NServiceBus.
52-
48+
Multiple endpoints in a single process cannot share a single Ninject kernel. Each one requires its own container instance or its own child container. Ninject supports this with the [Ninject.Extensions.ChildKernel](https://github.com/ninject/Ninject.Extensions.ChildKernel) extension. Execute `new ChildKernel(parentKernel)` and pass this new kernel instance to NServiceBus.
5349

5450
### DependencyLifecycle Mapping
5551

5652
[`DependencyLifecycle`](/nservicebus/dependency-injection/) maps to [Ninject object scopes](https://github.com/ninject/ninject/wiki/Object-Scopes) as follows:
5753

5854
| `DependencyLifecycle` | Ninject object scope |
5955
|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
60-
| [InstancePerCall](/nservicebus/dependency-injection/) | [Transient](https://github.com/ninject/ninject/wiki/Object-Scopes) |
61-
| [InstancePerUnitOfWork](/nservicebus/dependency-injection/) | [Singleton](https://github.com/ninject/ninject/wiki/Object-Scopes) within a [Named Scope](https://github.com/ninject/ninject.extensions.namedscope/wiki) per Unit of Work |
62-
| [SingleInstance](/nservicebus/dependency-injection/) | [Singleton](https://github.com/ninject/ninject/wiki/Object-Scopes) |
63-
56+
| [InstancePerCall](/nservicebus/dependency-injection/#service-registrations-instance-per-call) | [Transient](https://github.com/ninject/ninject/wiki/Object-Scopes) |
57+
| [InstancePerUnitOfWork](/nservicebus/dependency-injection/#service-registrations-instance-per-unit-of-work) | [Singleton](https://github.com/ninject/ninject/wiki/Object-Scopes) within a [Named Scope](https://github.com/ninject/ninject.extensions.namedscope/wiki) per Unit of Work |
58+
| [SingleInstance](/nservicebus/dependency-injection/#service-registrations-single-instance) | [Singleton](https://github.com/ninject/ninject/wiki/Object-Scopes) |
6459

65-
include: property-injection
60+
include: property-injection

persistence/sql/mysql-scripts.md

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,194 +1,160 @@
11
---
22
title: MySql Scripts
33
component: SqlPersistence
4-
reviewed: 2023-09-14
4+
reviewed: 2025-07-31
55
related:
66
- nservicebus/operations
77
- persistence/sql/operational-scripting
88
redirects:
99
- nservicebus/sql-persistence/mysql-scripts
1010
---
1111

12-
1312
Scripts and SQL used when interacting with a [MySql](https://www.mysql.com/) database.
1413

15-
1614
## Build Time
1715

1816
Scripts are created at build time and are executed as part of a deployment or decommissioning of an endpoint.
19-
2017

2118
### Outbox
2219

23-
2420
#### Create Table
2521

2622
snippet: MySql_OutboxCreateSql
2723

28-
2924
#### Drop Table
3025

3126
snippet: MySql_OutboxDropSql
3227

33-
3428
### Saga
3529

36-
For a Saga with the following structure
30+
For a Saga with the following structure
3731

3832
snippet: CreationScriptSaga
3933

40-
4134
#### Create Table
4235

4336
snippet: MySql_SagaCreateSql
4437

45-
4638
#### Drop Table
4739

4840
snippet: MySql_SagaDropSql
4941

50-
5142
### Subscription
5243

53-
5444
#### Create Table
5545

5646
snippet: MySql_SubscriptionCreateSql
5747

58-
5948
#### Drop Table
6049

6150
snippet: MySql_SubscriptionDropSql
6251

63-
6452
### Timeout
6553

66-
6754
#### Create Table
6855

6956
snippet: MySql_TimeoutCreateSql
7057

71-
7258
#### Drop Table
7359

7460
snippet: MySql_TimeoutDropSql
7561

76-
7762
## Run Time
7863

7964
SQL used at runtime to query and update data.
8065

81-
8266
### Outbox
8367

8468
Used at intervals to cleanup old outbox records.
8569

8670
snippet: MySql_OutboxCleanupSql
8771

88-
8972
#### Get
9073

9174
Used by `IOutboxStorage.SetAsDispatched`.
9275

9376
snippet: MySql_OutboxGetSql
9477

95-
9678
#### SetAsDispatched
9779

9880
Used by `IOutboxStorage.SetAsDispatched`.
9981

10082
snippet: MySql_OutboxSetAsDispatchedSql
10183

102-
10384
#### Store
10485

10586
Used by `IOutboxStorage.Store`.
10687

10788
partial: outbox
10889

109-
11090
### Saga
11191

112-
11392
#### Complete
11493

11594
Used by `ISagaPersister.Complete`.
11695

11796
snippet: MySql_SagaCompleteSql
11897

119-
12098
#### Save
12199

122100
Used by `ISagaPersister.Save`.
123101

124102
snippet: MySql_SagaSaveSql
125103

126-
127104
#### GetByProperty
128105

129106
Used by `ISagaPersister.Get(propertyName...)`.
130107

131108
snippet: MySql_SagaGetByPropertySql
132109

133-
134110
#### GetBySagaId
135111

136112
Used by `ISagaPersister.Get(sagaId...)`.
137113

138114
snippet: MySql_SagaGetBySagaIdSql
139115

140-
141116
#### Update
142117

143118
Used by `ISagaPersister.Update`.
144119

145120
snippet: MySql_SagaUpdateSql
146121

147-
148122
partial: finder
149123

150-
151124
### Subscription
152125

153-
154126
#### GetSubscribers
155127

156128
Used by `ISubscriptionStorage.GetSubscriberAddressesForMessage`.
157129

158130
snippet: MySql_SubscriptionGetSubscribersSql
159131

160-
161132
#### Subscribe
162133

163134
Used by `ISubscriptionStorage.Subscribe`.
164135

165136
snippet: MySql_SubscriptionSubscribeSql
166137

167-
168138
#### Unsubscribe
169139

170140
Used by `ISubscriptionStorage.Unsubscribe`.
171141

172142
snippet: MySql_SubscriptionUnsubscribeSql
173143

174-
175144
### Timeout
176145

177-
178146
#### Peek
179147

180148
Used by `IPersistTimeouts.Peek`.
181149

182150
snippet: MySql_TimeoutPeekSql
183151

184-
185152
#### Add
186153

187154
Used by `IPersistTimeouts.Add`.
188155

189156
snippet: MySql_TimeoutAddSql
190157

191-
192158
#### GetNextChunk
193159

194160
Used by `IQueryTimeouts.GetNextChunk`.
@@ -197,14 +163,12 @@ snippet: MySql_TimeoutNextSql
197163

198164
snippet: MySql_TimeoutRangeSql
199165

200-
201166
#### TryRemove
202167

203168
Used by `IPersistTimeouts.TryRemove`.
204169

205170
snippet: MySql_TimeoutRemoveByIdSql
206171

207-
208172
#### RemoveTimeoutBy
209173

210174
Used by `IPersistTimeouts.RemoveTimeoutBy`.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
#### Select used by Saga Finder
33

4-
snippet: MySql_SagaSelectSql
4+
snippet: MySql_SagaSelectSql

persistence/sql/mysql-scripts_outbox_sqlpersistence_[6,).partial.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
snippet: MySql_OutboxOptimisticStoreSql
44

5-
65
##### Pessimistic mode
76

87
snippet: MySql_OutboxPessimisticBeginSql
98

10-
snippet: MySql_OutboxPessimisticCompleteSql
9+
snippet: MySql_OutboxPessimisticCompleteSql

samples/entity-framework-core/sample.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,61 @@
11
---
22
title: Entity Framework Core integration with SQL Persistence
33
summary: Integrating Entity Framework Core with SQL Persistence.
4-
reviewed: 2023-08-11
4+
reviewed: 2025-07-31
55
component: SqlPersistence
66
related:
77
- persistence/sql
88
---
99

10-
1110
## Prerequisites
1211

1312
include: sql-prereq
1413

1514
The database created by this sample is `NsbSamplesEfCoreUowSql`.
1615

17-
1816
## Running the project
1917

2018
1. Start the solution
21-
2. The text `Press <enter> to send a message` will appear in both console windows
22-
3. Press <kbd>enter</kbd> in both console windows
19+
2. The text `Press <enter> to send a message` will appear in the console window
20+
3. Press <kbd>enter</kbd> to send an order
2321

2422
> [!NOTE]
2523
> If exceptions occur when running the sample, delete the tables from the database used by the code. By default, Entity Framework will not update table schemas. If tables use an old schema, the code won't execute properly.
2624
27-
2825
## Verifying that the sample works
2926

3027
1. `CreateOrderHandler` displays information that an order was submitted.
3128
2. `OrderLifecycleSaga` displays information that the order process has been started.
3229
3. `CreateShipmentHandler` displays information that the shipment has been created.
3330
4. After a few seconds, `CompleteOrderHandler` displays information that the order is going to be completed.
3431

35-
Open SQL Server Management Studio and go to the database. Verify that there is a row in the saga state table (`dbo.OrderLifecycleSagaData`), in the orders table (`dbo.Orders`), and in the shipments table (`dbo.Shipments`).
36-
32+
Open SQL Server Management Studio and go to the database. Verify that there is a row in the saga state table (`dbo.Samples.EntityFrameworkUnitOfWork.SQL.OrderLifecycleSagaData`), in the orders table (`dbo.Orders`), and in the shipments table (`dbo.Shipments`).
3733

3834
## Code walk-through
3935

4036
This sample contains the following projects:
4137

42-
* **Messages**: A class library containing the message definitions.
43-
* **Endpoint.SqlPersistence**: A console application running the endpoint with SQL persistence.
44-
38+
- **Messages**: A class library containing the message definitions.
39+
- **Endpoint.SqlPersistence**: A console application running the endpoint with SQL persistence.
4540

46-
### Endpoint projects
41+
### Endpoint project
4742

4843
The endpoint mimics a back-end system. It is configured to use the SQL Server transport. It uses Entity Framework to store business data (orders and shipments).
4944

5045
When the message arrives at the receiver, a single transactional data access context is created to ensure consistency of the entire message-handling process:
5146

52-
* the message is removed from the input queue by the SQL Server transport
53-
* a new saga instance is created and stored by the SQL persistence
54-
* a new `Order` entity is created
47+
- the message is removed from the input queue by the SQL Server transport
48+
- a new saga instance is created and stored by the SQL persistence
49+
- a new `Order` entity is created
5550

5651
snippet: StoreOrder
5752

58-
* a new `Shipment` entity is created
53+
- a new `Shipment` entity is created
5954

6055
snippet: StoreShipment
6156

62-
* a reply message is inserted to the queue
63-
* a timeout request is inserted to the queue
57+
- a reply message is inserted to the queue
58+
- a timeout request is inserted to the queue
6459

6560
Notice how storing the shipment retrieves the `Order` from the session cache of Entity Framework. The `Order` is not yet persisted to the database.
6661

0 commit comments

Comments
 (0)