Skip to content

Commit b38fbc4

Browse files
committed
Improved ReadMe files of certain extensions
1 parent 62319d1 commit b38fbc4

File tree

3 files changed

+89
-72
lines changed
  • Extensions
    • Xtensive.Orm.Localization/NugetContent
    • Xtensive.Orm.Reprocessing/NugetContent
    • Xtensive.Orm.Security/NugetContent

3 files changed

+89
-72
lines changed

Extensions/Xtensive.Orm.Localization/NugetContent/ReadMe.md

+29-26
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Examples of how to configure extension
115115

116116
Following examples show different ways to configure extension in configuration files of various types.
117117

118-
**Example #1** Confugure in App.config/Web.config
118+
**Example #1** Confugure default culture in App.config/Web.config
119119

120120
```xml
121121
<configuration>
@@ -132,20 +132,20 @@ Following examples show different ways to configure extension in configuration f
132132
</configuration>
133133
```
134134

135-
Such configuration is only compatible with System.Configuration.ConfigurationManager.
136-
If project still supports such configurations then Localization configuration will be read automatically when it needed to be read.
135+
Such configuration is usually read with ```System.Configuration.ConfigurationManager```.
136+
If project still supports such configurations then Localization configuration will be read automatically when it needs to be read.
137137
Sometimes a work-around is needed to read such configuration, for more read Example #2 and Example #3
138138

139139

140140
**Example #2** Reading old-style configuration of an assembly in NET 5 and newer.
141141

142142
Due to new architecture without AppDomain (which among the other things was in charge of gathering configuration files of loaded assemblies
143-
as it would be one configuration file) System.Configuration.ConfigurationManager now reads only configuration file of actual executable, loaded
143+
as it would be one configuration file) ```System.Configuration.ConfigurationManager``` now reads only configuration file of actual executable, loaded
144144
assemblies' configuration files stay unreachable by default, though there is need to read some data from them.
145145
A great example is test projects which are usually get loaded by test runner executable, and the only configuration accessible in this case
146146
is test runner one.
147147

148-
Extra step is required to read configuration files in such cases. Thankfully ConfigurationManager has methods to get access to assemblies' configurations.
148+
Extra step is required to read configuration files in such cases. Thankfully, ```ConfigurationManager``` has methods to get access to assemblies' configuration files.
149149

150150
To get access to an assembly configuration file it should be opened explicitly by
151151

@@ -165,18 +165,16 @@ The instance returned from ```OpenExeConfiguration``` provides access to section
165165
domainConfiguration.ExtensionConfigurations.Set(localizationConfig);
166166
```
167167

168-
The ```domainConfiguration.ExtensionConfigurations``` is a new unified place from which an extension will try to get its configuration
168+
The ```domainConfiguration.ExtensionConfigurations``` is a new unified place from which the extension will try to get its configuration
169169
instead of calling default parameterless ```Load()``` method, which has not a lot of sense now, though the method is kept as a second source
170170
for backwards compatibility.
171171

172-
For more convenience, DomainConfiguration extensions are provided, which make code more neat and clear.
172+
For more convenience, ```DomainConfiguration``` extensions are provided, which make code neater.
173173
For instance,
174174

175175
```csharp
176176
var configuration = ConfigurationManager.OpenExeConfiguration(typeof(SomeTypeInConfigOwnerAssembly).Assembly.Location);
177177

178-
var domainConfiguration = DomainConfiguration.Load(configuration);
179-
180178
// the extension hides getting configuration with LocalizationConfiguration.Load(configuration)
181179
// and also putting it to ExtensionConfigurations collection.
182180
domainConfiguration.ConfigureLocalizationExtension(configuration);
@@ -189,7 +187,7 @@ Custom section names are also supported if for some reason default section name
189187

190188
If for some reason there is need to keep the old-style configuration then there is a work-around as well.
191189
Static configuration manager provides method ```OpenMappedExeConfiguration()``` which allows to get
192-
any *.config file as ```System.Configuration.Configuration``` instance. For example
190+
any *.config file as ```System.Configuration.Configuration``` instance. For example,
193191

194192
```csharp
195193
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
@@ -198,17 +196,15 @@ any *.config file as ```System.Configuration.Configuration``` instance. For exam
198196
```
199197

200198
After that, as in previous example, the instance can be passed to ```Load``` method of ```LocalizationConfiguration``` to read extension configuration
201-
and later put it to ```DomainConfiguration.ExtensionConfigurations```.
202-
After ```System.Configuration.Configuration``` instance is provided it is possible to pass it into Load method of different DataObjects.Net configurations,
203-
including ```LocalizationConfiguration```. Then put localization configuration to ```DomainConfiguration.ExtensionConfigurations``` collection.
199+
and later put it to ```DomainConfiguration.ExtensionConfigurations```
204200

205201
```csharp
206202
var localizationConfiguration = LocalizationConfiguration.Load(configuration);
207203

208204
domainConfiguration.ExtensionConfigurations.Set(localizationConfiguration);
209205
```
210206

211-
or to extension method
207+
Extension usage will look like
212208

213209
```csharp
214210
domainConfiguration.ConfigureLocalizationExtension(configuration);
@@ -220,7 +216,7 @@ or to extension method
220216
This API allows to have configurations in various forms including JSON and XML formats.
221217
Loading of such files may differ depending on .NET version, check Microsoft manuals for instructions.
222218

223-
Allowed Json and Xml configuration definition look like below
219+
Allowed JSON and XML configuration definition look like below
224220

225221
```xml
226222
<configuration>
@@ -238,14 +234,13 @@ Allowed Json and Xml configuration definition look like below
238234
}
239235
```
240236

241-
The API has certain issues with Xml elements with attributes so it is recommended to use
237+
The API has certain issues with XML elements with attributes so it is recommended to use
242238
more up-to-date attributeless nodes.
243-
For JSON it is pretty clear.
239+
For JSON it is pretty clear, almost averyone knows its format.
244240

245-
```LocalizationConfiguration.Load``` method can accept different types of abstractions from the
246-
API, including
247-
- ```Microsoft.Extensions.Configuration.IConfiguration```,
248-
- ```Microsoft.Extensions.Configuration.IConfigurationRoot```
241+
```LocalizationConfiguration.Load``` method can accept different types of abstractions from the API, including
242+
- ```Microsoft.Extensions.Configuration.IConfiguration```;
243+
- ```Microsoft.Extensions.Configuration.IConfigurationRoot```;
249244
- ```Microsoft.Extensions.Configuration.IConfigurationSection```.
250245

251246
Loading of configuration may look like
@@ -254,19 +249,23 @@ Loading of configuration may look like
254249

255250
var app = builder.Build();
256251

252+
//...
253+
257254
// tries to load from default section "Xtensive.Orm.Localization"
258255
var localizationConfig = LocalizationConfiguration.Load(app.Configuration);
259256

260257
domainConfiguration.ExtensionConfigurations.Set(localizationConfig);
261258
```
262259

263-
or, with use of extension
260+
or, with use of extension, like
264261

265262

266263
```csharp
267264

268265
var app = builder.Build();
269266

267+
//...
268+
270269
// tries to load from default section "Xtensive.Orm.Localization"
271270
// and additionally adds Xtensive.Orm.Localization assembly to domain types.
272271
@@ -301,17 +300,17 @@ Loading of configuration may look like
301300

302301
var app = builder.Build();
303302

303+
//...
304+
304305
var localizationConfig = LocalizationConfiguration.Load(app.Configuration, "Orm.Localization");
305306

306307
domainConfiguration.ExtensionConfigurations.Set(localizationConfig);
307308
```
308309

309-
or with use of extension
310+
or, with use of extension, like
310311

311312
```csharp
312-
313313
var app = builder.Build();
314-
315314
domainConfiguration.ConfigureLocalizationExtension(app.Configuration, "Orm.Localization");
316315
```
317316

@@ -348,6 +347,8 @@ Then section must be provided manually, code may look like
348347

349348
var app = builder.Build();
350349

350+
//...
351+
351352
var configurationRoot = app.Configuration;
352353
var extensionsGroupSection = configurationRoot.GetSection("Orm.Extensions");
353354
var localizationSection = extensionsGroupSection.GetSection("Xtensive.Orm.Localization");
@@ -356,12 +357,14 @@ Then section must be provided manually, code may look like
356357
domainConfiguration.ExtensionConfigurations.Set(localizationConfig);
357358
```
358359

359-
or with use of extension method
360+
or, with use of extension method, like
360361

361362
```csharp
362363

363364
var app = builder.Build();
364365

366+
//...
367+
365368
var configurationRoot = app.Configuration;
366369
var extensionsGroupSection = configurationRoot.GetSection("Orm.Extensions");
367370
var localizationSection = extensionsGroupSection.GetSection("Xtensive.Orm.Localization");

Extensions/Xtensive.Orm.Reprocessing/NugetContent/ReadMe.md

+29-22
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ Following examples show different ways to configure extension in configuration f
6363
</configuration>
6464
```
6565

66-
Such configuration is only compatible with System.Configuration.ConfigurationManager.
67-
If project still supports such configurations then Reprocessing configuration will be read automatically when it needed to be read.
66+
Such configuration is usually read with ```System.Configuration.ConfigurationManager```.
67+
If project still supports such configurations then Reprocessing configuration will be read automatically when it needs to be read.
6868
Sometimes a work-around is needed to read such configuration, for more read Example #2 and Example #3
6969

7070

7171
**Example #2** Reading old-style configuration of an assembly in NET 5 and newer.
7272

7373
Due to new architecture without AppDomain (which among the other things was in charge of gathering configuration files of loaded assemblies
74-
as it would be one configuration file) System.Configuration.ConfigurationManager now reads only configuration file of actual executable, loaded
74+
as it would be one configuration file) ```System.Configuration.ConfigurationManager``` now reads only configuration file of actual executable, loaded
7575
assemblies' configuration files stay unreachable by default, though there is need to read some data from them.
7676
A great example is test projects which are usually get loaded by test runner executable, and the only configuration accessible in this case
7777
is test runner one.
7878

79-
Extra step is required to read configuration files in such cases. Thankfully ConfigurationManager has methods to get access to assemblies' configurations.
79+
Extra step is required to read configuration files in such cases. Thankfully, ```ConfigurationManager``` has methods to get access to assemblies' configuration files.
8080

8181
To get access to an assembly configuration file it should be opened explicitly by
8282

@@ -96,18 +96,16 @@ The instance returned from ```OpenExeConfiguration``` provides access to section
9696
domainConfiguration.ExtensionConfigurations.Set(reprocessingConfig);
9797
```
9898

99-
The ```domainConfiguration.ExtensionConfigurations``` is a new unified place from which an extension will try to get its configuration
99+
The ```domainConfiguration.ExtensionConfigurations``` is a new unified place from which the extension will try to get its configuration
100100
instead of calling default parameterless ```Load()``` method, which has not a lot of sense now, though the method is kept as a second source
101101
for backwards compatibility.
102102

103-
For more convenience, DomainConfiguration extensions are provided, which make code more neat and clear.
103+
For more convenience, ```DomainConfiguration``` extensions are provided, which make code more neater.
104104
For instance,
105105

106106
```csharp
107107
var configuration = ConfigurationManager.OpenExeConfiguration(typeof(SomeTypeInConfigOwnerAssembly).Assembly.Location);
108108

109-
var domainConfiguration = DomainConfiguration.Load(configuration);
110-
111109
// the extension hides getting configuration with ReprocessingConfiguration.Load(configuration)
112110
// and also putting it to ExtensionConfigurations collection.
113111
domainConfiguration.ConfigureReprocessingExtension(configuration);
@@ -120,7 +118,7 @@ Custom section names are also supported if for some reason default section name
120118

121119
If for some reason there is need to keep the old-style configuration then there is a work-around as well.
122120
Static configuration manager provides method ```OpenMappedExeConfiguration()``` which allows to get
123-
any *.config file as ```System.Configuration.Configuration``` instance. For example
121+
any *.config file as ```System.Configuration.Configuration``` instance. For example,
124122

125123
```csharp
126124
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
@@ -129,17 +127,15 @@ any *.config file as ```System.Configuration.Configuration``` instance. For exam
129127
```
130128

131129
After that, as in previous example, the instance can be passed to ```Load``` method of ```ReprocessingConfiguration``` to read extension configuration
132-
and later put it to ```DomainConfiguration.ExtensionConfigurations```.
133-
After ```System.Configuration.Configuration``` instance is provided it is possible to pass it into Load method of different DataObjects.Net configurations,
134-
including ```ReprocessingConfiguration```. Then put reprocessing configuration to ```DomainConfiguration.ExtensionConfigurations``` collection.
130+
and later put it to ```DomainConfiguration.ExtensionConfigurations```
135131

136132
```csharp
137133
var reprocessingConfiguration = ReprocessingConfiguration.Load(configuration);
138134

139135
domainConfiguration.ExtensionConfigurations.Set(reprocessingConfiguration);
140136
```
141137

142-
or to extension method
138+
Extension usage will look like
143139

144140
```csharp
145141
domainConfiguration.ConfigureReprocessingExtension(configuration);
@@ -151,7 +147,7 @@ or to extension method
151147
This API allows to have configurations in various forms including JSON and XML formats.
152148
Loading of such files may differ depending on .NET version, check Microsoft manuals for instructions.
153149

154-
Allowed Json and Xml configuration definition look like below
150+
Allowed JSON and XML configuration definition look like below
155151

156152
```xml
157153
<configuration>
@@ -173,12 +169,11 @@ Allowed Json and Xml configuration definition look like below
173169

174170
The API has certain issues with Xml elements with attributes so it is recommended to use
175171
more up-to-date attributeless nodes.
176-
For JSON it is pretty clear.
172+
For JSON it is pretty clear, almost averyone knows its format.
177173

178-
```ReprocessingConfiguration.Load``` method can accept different types of abstractions from the
179-
API, including
180-
- ```Microsoft.Extensions.Configuration.IConfiguration```,
181-
- ```Microsoft.Extensions.Configuration.IConfigurationRoot```
174+
```ReprocessingConfiguration.Load``` method can accept different types of abstractions from the API, including
175+
- ```Microsoft.Extensions.Configuration.IConfiguration```;
176+
- ```Microsoft.Extensions.Configuration.IConfigurationRoot```;
182177
- ```Microsoft.Extensions.Configuration.IConfigurationSection```.
183178

184179
Loading of configuration may look like
@@ -187,19 +182,23 @@ Loading of configuration may look like
187182

188183
var app = builder.Build();
189184

185+
//...
186+
190187
// tries to load from default section "Xtensive.Orm.Reprocessing"
191188
var reprocessingConfig = ReprocessingConfiguration.Load(app.Configuration);
192189

193190
domainConfiguration.ExtensionConfigurations.Set(reprocessingConfig);
194191
```
195192

196-
or, with use of extension
193+
or, with use of extension, like
197194

198195

199196
```csharp
200197

201198
var app = builder.Build();
202199

200+
//...
201+
203202
// tries to load from default section "Xtensive.Orm.Reprocessing"
204203
// and put it into domainConfiguration.ExtensionConfigurations
205204
@@ -236,17 +235,21 @@ Loading of configuration may look like
236235

237236
var app = builder.Build();
238237

238+
//...
239+
239240
var reprocessingConfig = ReprocessingConfiguration.Load(app.Configuration, "Orm.Reprocessing");
240241

241242
domainConfiguration.ExtensionConfigurations.Set(reprocessingConfig);
242243
```
243244

244-
or with use of extension
245+
or, with use of extension, like
245246

246247
```csharp
247248

248249
var app = builder.Build();
249250

251+
//...
252+
250253
domainConfiguration.ConfigureReprocessingExtension(app.Configuration, "Orm.Reprocessing");
251254
```
252255

@@ -285,6 +288,8 @@ Then section must be provided manually, code may look like
285288

286289
var app = builder.Build();
287290

291+
//...
292+
288293
var configurationRoot = app.Configuration;
289294
var extensionsGroupSection = configurationRoot.GetSection("Orm.Extensions");
290295
var reprocessingSection = extensionsGroupSection.GetSection("Xtensive.Orm.Reprocessing");
@@ -294,12 +299,14 @@ Then section must be provided manually, code may look like
294299
domainConfiguration.ExtensionConfigurations.Set(reprocessingConfig);
295300
```
296301

297-
or with use of extension method
302+
or, with use of extension method, like
298303

299304
```csharp
300305

301306
var app = builder.Build();
302307

308+
//...
309+
303310
var configurationRoot = app.Configuration;
304311
var extensionsGroupSection = configurationRoot.GetSection("Orm.Extensions");
305312
var reprocessingSection = extensionsGroupSection.GetSection("Xtensive.Orm.Reprocessing");

0 commit comments

Comments
 (0)