How can I prevent OrmLite from adjusting the case of the fields being returned by a stored procedure into POCO?

Viewed 21

I have a column being returned from stored procedure called CV_Filename

public class FileNames
{
    public string CV_Filename { get; set; }
}

app.MapGet("/filenames", () =>
{    
    var dbFactory = new OrmLiteConnectionFactory(
        SqlServerBuildDb, SqlServer2019Dialect.Provider);

    using (var db = dbFactory.Open())
    {
        List<FileNames> resultlist = db.SqlList<FileNames>("EXEC proc_s_GetFileNames");
        return resultlist;
    }

}).Produces<List<FileNames>>(statusCode: 200);

But the returned resultlist fieldname is cV_FileName from the API.

How can I configure OrmLite to ignore any adjustments of case?

Thanks

1 Answers

If you're referring to JSON Serialization casing you can specify the exact name to use by using .NET's DataContractSerializer [DataMember] attributes, e.g:

[DataContract]
public class FileNames
{
    [DataMember(Name="CV_Filename")]
    public string CV_Filename { get; set; }
}

Related