[Alias(t1")]
class Track
{
[Alias(n1")]
public string Name{get;set;}
[Alias(n2")]
public string Name1{get;set;}
[Alias("n3")]
public string Name2{get;set;}
}
HashSet<string> uniqueTrackNames = db.ColumnDistinct<string>(
db.From<Track>().Select(x => x.Name)) //this way result uncorrect
HashSet<string> uniqueTrackNames = db.ColumnDistinct<string>("select n1 from t1") // this is ok
Please upgrade if you aren’t using the latest v4.0.60 of OrmLite otherwise if it’s still an issue it should work as expected with the latest pre-release v4.0.61 on MyGet.
[Alias("t1")]
class TableWithAliases
{
public int Id { get; set; }
[Alias("n1")]
public string Name { get; set; }
[Alias("n2")]
public string Name1 { get; set; }
[Alias("n3")]
public string Name2 { get; set; }
}
```
just like your test , I have 2 computers and I track the db.GetLastSql(),
on PC1, result is OK, and the sql is ``` select "n1" from "t1" ```
on PC2, result is wrong, and the sql is ``` select "Name" from "t1"```,
I use the same latest dll (mono.sqlite ) from MyGet...
var uniqueTrackNames = db.ColumnDistinct<string>(
db.From<TableWithAliases>().Select(x => x.Name));
db.GetLastSql().Print();
Is printing out:
SELECT "n1"
FROM "t1"
As expected, so it should work with the latest version on MyGet. If you had a previous version of MyGet installed you’ll need to clear your NuGet cache to download the latest version.