I have only used AutoQuery with single tables but my customer needs to be able to query against related fields.
CREATE TABLE [dbo].[tbl_Issues](
[id] [int] IDENTITY(1,1) NOT NULL,
[coc] nvarchar NULL,
[issue] nvarchar NULL,
[communication] [int] NULL,
[date_added] datetime2 NOT NULL,
[collectionSiteid] [int] NOT NULL)
CREATE TABLE [dbo].[tbl_COLLECTION_SITES](
[ID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[COLLECTION_SITE] varchar NULL,
[ADDRESS] varchar NULL, …)
I had:
public class FindIssue : QueryDb
and that is working well for querying tbl_Issues.
Modified to:
public class FindIssue : QueryDb, IJoin<Issue,CollectionSite>
and now:
AutoQuery.CreateQuery(query, Request, db)
is throwing Exception:
“Could not infer relationship between tbl_Issues and tbl_Collection_Sites”
How can I define the relationship?