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
@@ -433,8 +428,11 @@ The primary difference is that they only exist in a .NET Assembly in memory crea
433
428
Peeking deeper behind the `AutoRegister` flag will reveal that it's a helper for adding an empty `CreateCrudServices` instance, i.e. it's equivalent to:
434
429
435
430
```csharp
436
-
Plugins.Add(new AutoQueryFeature {
431
+
var ormLite = services.AddOrmLite(options => options.UseSqlite(connString));
432
+
433
+
services.AddPlugin(new AutoQueryFeature {
437
434
GenerateCrudServices = new GenerateCrudServices {
435
+
DbFactory = ormLite.DbFactory,
438
436
CreateServices = {
439
437
new CreateCrudServices()
440
438
}
@@ -452,9 +450,11 @@ Although should you wish to, you can also generate Services for multiple Databas
452
450
With this you could have a single API Gateway Servicifying access to multiple System RDBMS Tables & Schemas, e.g:
453
451
454
452
```csharp
455
-
Plugins.Add(new AutoQueryFeature {
453
+
var ormLite = services.AddOrmLite(options => options.UseSqlite(connString));
454
+
455
+
services.AddPlugin(new AutoQueryFeature {
456
456
GenerateCrudServices = new GenerateCrudServices {
457
-
DbFactory = dbFactory,
457
+
DbFactory = ormlite.DbFactory,
458
458
CreateServices = {
459
459
new CreateCrudServices(),
460
460
new CreateCrudServices { Schema = "AltSchema" },
@@ -505,7 +505,7 @@ var tableRequiredFields = new Dictionary<string,string[]> {
Copy file name to clipboardExpand all lines: MyApp/_pages/autoquery/crud.md
+3-7Lines changed: 3 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -550,11 +550,7 @@ public class QueryRockstarAudit : QueryDbTenant<RockstarAuditTenant, Rockstar>
550
550
}
551
551
```
552
552
553
-
To coincide with AutoCRUD there's also support for [declarative validation](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.Validate.cs) which thanks to [#Script](https://sharpscript.net/) lets you define your Fluent Validation Rules by annotating your Request DTO properties. As it's essentially a different way to define Fluent Validation Rules, it still [needs Validation enabled](/validation#validation-feature) to run:
554
-
555
-
```csharp
556
-
Plugins.Add(newValidationFeature());
557
-
```
553
+
To coincide with AutoCRUD there's also support for [declarative validation](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/AutoQueryCrudTests.Validate.cs) which thanks to [#Script](https://sharpscript.net/) lets you define your Fluent Validation Rules by annotating your Request DTO properties. As it's essentially a different way to define Fluent Validation Rules, it still [needs Validation enabled](/validation#validation-feature).
AutoQuery includes `OnBefore*` and `OnAfter*` (sync & async) events for `Create`, `Update`, `Patch` & `Delete` that can be used to execute custom logic before or after each AutoQuery CRUD operation. E.g. if your system implements their own Audit history via RDBMS triggers, you can use the `OnBefore`**Delete** event to update the record with deleted info before the AutoQuery CRUD operation deletes it:
Which is all that's needed to enable the AutoQuery feature. The AutoQueryFeature is inside [ServiceStack.Server](https://servicestack.net/download#get-started) NuGet package which contains value-added features that utilize either OrmLite and Redis which can be added to your project with:
@@ -658,7 +658,7 @@ Which is why we recommend formalizing your conventions you want to allow before
658
658
When publishing your API, you can also assert that only explicit conventions are ever used by disabling untyped implicit conventions support with:
0 commit comments