Skip to content

Instantly share code, notes, and snippets.

@adlerpagliarini
Last active April 15, 2019 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adlerpagliarini/0ad175df3c6e59cb761832a001864d56 to your computer and use it in GitHub Desktop.
Save adlerpagliarini/0ad175df3c6e59cb761832a001864d56 to your computer and use it in GitHub Desktop.
public static class ODataEntitiesConfiguration
{
public static IEdmModel GetEdmModel(IServiceProvider provider)
{
var builder = new ODataConventionModelBuilder(provider);
builder.EntitySet<Developer>(nameof(Developer)).EntityType
.Expand(SelectExpandType.Automatic)
.Filter()
.OrderBy()
.Count()
.Page()
.Select();
// Enables Select for TaskToDo IF it isn't configured
// .HasMany(t => t.TasksToDo).Select();
builder.EntitySet<TaskToDo>(nameof(TaskToDo)).EntityType
.Expand()
.Filter()
.OrderBy()
.Select();
return builder.GetEdmModel();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment