I’m playing around with AutoGen AutoCrud because it will be super useful in exposing an API over our reporting database. However, I’ve run into an issue where no code is being generated when I navigate to /crud/all/csharp. Below is the output I get from this database schema
/* Options:
Date: 2020-05-26 19:12:12
Version: 5.81
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: http://localhost:5000
UsePath: /crud/all/csharp
//GlobalNamespace:
//MakePartial: False
//MakeVirtual: False
//MakeInternal: False
//MakeDataContractsExtensible: False
//AddReturnMarker: True
//AddDescriptionAsComments: True
//AddDataContractAttributes: True
//AddIndexesToDataMembers: True
//AddGeneratedCodeAttributes: False
//AddResponseStatus: False
//AddImplicitVersion:
//InitializeCollections: False
//ExportValueTypes: False
//IncludeTypes:
//ExcludeTypes:
//AddNamespaces:
//AddDefaultXmlNamespace:
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
This allows you to access the generated code, but if you want to make use of the AutoGen feature (which autoregisters + impls AutoQuery Services), you’ll need to list all the schemas you want Services generated in CreateServices, e.g:
Plugins.Add(new AutoQueryFeature {
MaxLimit = 100,
GenerateCrudServices = new GenerateCrudServices {
CreateServices = new List<CreateCrudServices> {
new CreateCrudServices { Schema = "carburetor" },
}
}
});
I’ve just debugged it, it’s because none of the tables in that schema have a primary key. All AutoQuery has the same limitations as OrmLite where every table requires a Single Primary Key.