Ssutil to generate DTO class, ambigous reference

i’m using ssutil to generate my class file for the DTO.
The problem is that i have a database table called LicenseType and it’s used in my DTOS.

Servicestack has an enum called the same and when i generate my DTO class i get the error

‘LicenseType’ is an ambiguous reference between ‘BokaMera.API.ServiceModel.Db.LicenseType’ and ‘ServiceStack.LicenseType’

I have defined the namespace in my DTO but when generated is removed and therefore this error.
Can I get around this somehow without renaming my db table?

It’s not clear why you’re getting the Error and what it has to do with a DB Table? is ServiceStack.LicenseType being somehow included in the generated DTOs?

It shouldn’t be included which would be suggest a configuration/conflict error somewhere, but you can try excluding Types with the ExcludeTypes modifier.

I would need to understand what the error is in order to be able to help any further, can you provide the generated DTOs that’s causing the issue?

Because you have a naming conflict another solution is renaming your LicenseType to a different class and using the [Alias] attribute to map it to the LicenseType RDBMS table, e.g:

[Alias("LicenseType")] //Maps to LicenseType RDBMS table
public class MyLicenseType { ... }

Hi again, sorry for late reply.

The problem is that the i have the namespace in the DTO but also a reference to servicestack dll
You can see it marked with bold that it contains Db. before.
As Servicestack DLL also has a type called LicenseType

But when the file generated with SSUtil it removes the Db. before the class makes the DTO not knowing if it’s the LicenseType from Servicestack or from my class to use.

Summary = “Get whats included in each license”,
Notes =
“This service is used to get to summare of information about whats included in each license.”,
Verbs = “GET”)]
[ApiResponse(HttpStatusCode.Unauthorized, “You were unauthorized to call this service”)]
public class LicenseInformationQuery : QueryDb<Db.LicenseInformation, LicenseTypeQueryResponse>

       Description =
           "If you want to include the connected licens prices",
       ParameterType = "query",
       DataType = "boolean",
       IsRequired = false)]
    public bool IncludeLicensePrices { get; set; }

    public ResponseStatus ResponseStatus { get; set; }

Here is a part from the generated DTO

[Route("/licenses/types/", "GET")]
    [ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)]
    public partial class LicenseTypeQuery
        : QueryDb<LicenseType, LicenseTypeQueryResponse>, IReturn<QueryResponse<LicenseTypeQueryResponse>>, IMeta
        ///If you want to only select Extra license options
        [ApiMember(DataType="boolean", Description="If you want to only select Extra license options", ParameterType="query")]
        public virtual bool? ExtraLicenseOption { get; set; }

        ///If you want to include the connected license items
        [ApiMember(DataType="boolean", Description="If you want to include the connected license items", ParameterType="query")]
        public virtual bool IncludeLicenseItems { get; set; }

        ///If you want to include the connected licens prices
        [ApiMember(DataType="boolean", Description="If you want to include the connected licens prices", ParameterType="query")]
        public virtual bool IncludeLicensePrices { get; set; }

        public virtual ResponseStatus ResponseStatus { get; set; }

Now I’m confused why have you highlighted the Db.LicenseInformation class and what does it have to do with LicenseType? If the LicenseType Type is being generated in the DTOs please provide it.

If your DTOs have a reference to anything other than ServiceStack.Interfaces.dll remove the reference as they should only reference ServiceStack.Interfaces.

Using the Alias attribute and renaming your Type is still a solution.

Hi, I solved it by adding this to AppHost

   var nativeTypes = this.GetPlugin<NativeTypesFeature>();
        nativeTypes.MetadataTypesConfig.AddNamespaces = new List<string> {
            "LicenseType = BokaMera.API.ServiceModel.Db.LicenseType"