I have hotchoc all connected up to EF and a sqlserver db. Here is my query...
query
{
accounts {
holdings {
holdingId
}
}
}
If I don't have [UseSelection] on my accounts method, the sql statement pulls all the fields on the accounts table but doesn't do a join to holdings. If I put [UseSelection] on accounts then it correctly selects just the fields I want and joins to holdings to get holdingId. However, it also fires this sql statement...
SELECT [e].[AccountID]\r\nFROM [Accounts] AS [e]\r\nORDER BY [e].[AccountID]
What is this extra sql statement for? Have I done something wrong?
My Account entity...
public class Account : BaseEntity
{
public Account()
{
AccrualTransactions = new HashSet<AccrualTransaction>();
Transactions = new HashSet<Transaction>();
Holdings = new HashSet<Holding>();
}
public int AccountId { get; set; }
public string AccountName { get; set; }
public string AccountNumber { get; set; }
public ICollection<Transaction> Transactions { get; set; }
public ICollection<Holding> Holdings { get; set; }
}
The table structure is pretty simple. Holdings table has an AccountId. The Account table has a lot of fields but nothing suspicous.