AutoGen AutoCrud Services Not Generating Output

Hi Mythz,

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;

Any help/direction would be appreciated.

Thanks,
Deon

What does your AppHost AutoQuery configuration look like?

Pretty vanilla. I pulled down the NorthwindAuto project and configured it to point to my local MS SQL Server:

Plugins.Add(new AutoQueryFeature  {
   MaxLimit = 100,
   GenerateCrudServices = new GenerateCrudServices {}
});

It’s because your tables are stored in different schemas, you’ll need to specify which schema you want to generate the C# Types for, e.g:

https://localhost:5001/crud/all/csharp?schema=carburetor

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" },
        }
    }
});

Awesome that’s way better. There’s one schema that still doesn’t generate on my end, datahub, can
you see if there is anything funky with that one?

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.

1 Like

cool, back to the drawingboard. Thanks for the help @mythz

1 Like