I have a table which has the following columns:
| UserId | UserName | SortCode | AccountNumber |
And I have the following C# classes
public class User
{
public int UserId { get; set; }
public string UserName { get; set; }
public Account Account { get; set; }
}
public class Account
{
public string SortCode { get; set; }
public string AccountNumber { get; set; }
}
I need to map the SortCode column to the Account.SortCode object. The same with the AccountNumber.
I was trying something like this
const string query = @"SELECT UserId, UserName, SortCode AS [Account.SortCode], AccountNumber AS [Account.AccountNumber], FROM [dbo].[Users];";
return db.Query<User>(query);
But is is not working. Any help?.
Thanks!!