-
Notifications
You must be signed in to change notification settings - Fork 23
ODataControllerBase
Tomas Fabian edited this page Apr 29, 2020
·
5 revisions
public class ProductsController : ODataControllerBase<Product>
{
public ProductsController(IRepository<Product> repository)
: base(repository)
{
}
}
Key is extracted from KeyAttribute
[Key(nameof(Product.Id))]
public class Product : Joker.Domain.DomainEntity<string>
{
}
public class ProductsController : ODataControllerBase<Product>
{
public ProductsController(IRepository<Product> repository)
: base(repository)
{
}
protected override IQueryable<Product> OnGetAll(ODataQueryOptions<Product> queryOptions)
{
return base.OnGetAll(queryOptions);
}
protected override Task<int> OnPost(Product entity)
{
return base.OnPost(entity);
}
protected override Task<int> OnPut(Product entity)
{
return base.OnPut(entity);
}
protected override Task<int> OnDelete(int key)
{
return base.OnDelete(key);
}
protected override dynamic TryGetDbSet(Type entityType)
{
return base.TryGetDbSet(entityType);
}
protected override Task<IActionResult> OnCreateRef(string navigationProperty, Uri link)
{
return base.OnCreateRef(navigationProperty, link);
}
protected override Task<IActionResult> OnDeleteRef(string navigationProperty)
{
return base.OnDeleteRef(navigationProperty);
}
}