I have a Linq-to-SQL model that uses stored procs in some places to return the objects where more complex SQL is required. This all works fine.
I now need to return a custom object from an SP that also encapsulates a Linq-to-SQL object. For example, I have a class called Employee based on an Employee table. I also have a custom class called rota defined as follows:
public class rota
{
public Employee employee{ get; set; }
public int DisplayOrder { get; set; }
public DateTime StartingTime { get; set; }
public DateTime FinishTime { get; set; }
}
I have some fairly complex linq that calculates an employees rota for any given day and then returns that object. I want to move this logic to a stored procedure so I have total control over the sql (the generated sql is not great) however I am not sure how to return that object?