Skip to content

Commit fbaf899

Browse files
committed
Update ICrudEvents to use ConfigureAutoQuery modular startup config
1 parent 06390e3 commit fbaf899

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

MyApp/_pages/autoquery/audit-log.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,25 @@ provider which will let you persist your events in any data store, but typically
2727
the same RDBMS that the AutoCrud requests are already writing to, e.g:
2828

2929
```csharp
30-
container.AddSingleton<ICrudEvents>(c =>
31-
new OrmLiteCrudEvents(c.Resolve<IDbConnectionFactory>()) {
32-
// NamedConnections = { SystemDatabases.Reporting }
33-
});
34-
container.Resolve<ICrudEvents>().InitSchema();
30+
public class ConfigureAutoQuery : IHostingStartup
31+
{
32+
public void Configure(IWebHostBuilder builder) => builder
33+
.ConfigureServices(services => {
34+
// Enable Audit History
35+
services.AddSingleton<ICrudEvents>(c =>
36+
new OrmLiteCrudEvents(c.GetRequiredService<IDbConnectionFactory>()) {
37+
// NamedConnections = { SystemDatabases.Reporting }
38+
});
39+
40+
services.AddPlugin(new AutoQueryFeature {
41+
MaxLimit = 1000,
42+
//IncludeTotal = true,
43+
});
44+
})
45+
.ConfigureAppHost(appHost => {
46+
appHost.Resolve<ICrudEvents>().InitSchema();
47+
});
48+
}
3549
```
3650

3751
If you’re using Multitenancy features or multiple RDBMS’s in your AutoCrud DTOs you can add them to NamedConnections where

0 commit comments

Comments
 (0)