I have the following code:
public class AwardTitle
{
public int AwardTitleId
{
get;
set;
}
public int? EpisodeId
{
get;
set;
}
public virtual AwardEpisode Episode
{
get;
set;
}
}
public class AwardEpisode
{
public int EpisodeId
{
get;
set;
}
}
public static class WebApiConfig
{
public static void Register( HttpConfiguration config )
{
config.Routes.MapODataRoute( "ODataRoute", "api", GetImplicitEDM( ) );
}
}
private static Microsoft.Data.Edm.IEdmModel GetImplicitEDM( )
{
var builder = new ODataConventionModelBuilder( );
builder.EntitySet<AwardTitle>( "AwardTitles" );
return builder.GetEdmModel( );
}
Notice how I have only mapped the AwardTitle
class... not the AwardEpisode
class.
Now, when I browse to the controller, I would expect to get an error about not having AwardEpisode
mapped. However, there is no error. In fact, in addition to AwardTitle
being retrieved... AwardEpisode
is also being retrieved... without any explicit calls to do so.
How is this possible??? Should this be possible??
I'm using ASP.Net Web API 2 on Windows 7.