If i have a Person class which have Dog class property :
public class Person{
public string Name {get;set;}
public Dog Doggie {get;set;}
}
On a single SP call i want to populate both dog object and person object, but i cant figure out how to do that.
CREATE PROCEDURE Test
AS
BEGIN
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT
Name = p.Person_Name,
Doggie.Name (This fails) = d.Dog_Name
FROM My fancy join......
END
GO
public Person GetByUid(Guid uid)
{
Person personToReturn;
using (var connection = this.connectionFactory.GetOpenConnection())
{
try
{
personToReturn= connection.Query<Person>("ProcedureName",
new { personUid = uid },
commandType: CommandType.StoredProcedure).Single();
}
catch ()
{
return null;
}
}
return personToReturn;
}
Is it possible?