July 4, 2020, 5:58pm
Im trying to add simple row level security and join user table the following way:
var query =
db.From<ResearchEntity>().Where(x => x.Id == id);
query.Join<AppUserAuth>((x, y) => x.CreatedBy.Id == int.Parse(session.UserAuthId));
var data = await db.LoadSelectAsync(query);
I am getting from MySQL: “Column ‘Id’ in where clause is ambiguous”
I have tried to add table options with alias with no success…
What am I missing?
July 4, 2020, 8:25pm
You can’t query on nested columns, e.g x.CreatedBy.Id i.e. you can only query the columns of the table you’re joining as you would in SQL.
July 5, 2020, 4:39am
I have on
ResearchEntity the fields
I want to join the
CreatedBy and do where clause on the
What are my options?
July 5, 2020, 6:00am
With OrmLite you’d structure your query how you would in SQL, than Type it. There’s no magic query conversions, it’s essentially just a Typed SQL query with any custom Select projections at the end. Querying a field on a joined table is the same as you would do it in SQL.