Hi Muhammad,
What I was able to find out was that recently a change was made to remove the direct dependency of the extension code with the OData. It would be good if the extension code can migrate to this new model.
NOTE: The old extension model should still continue to work and supported one year from the data of publishing 10.0.11.
The latest sample extension has explicitly removed using them:
10.0.11 and higher:
/// <summary>
/// The controller to retrieve a new entity.
/// </summary>
[RoutePrefix("StoreHours")]
[BindEntity(typeof(SampleDataModel.StoreDayHours))]
public class StoreHoursController : IController
{
/// <summary>
/// Gets the store hours for a given store.
/// </summary>
/// <param name="parameters">The parameters to this action.</param>
/// <returns>The list of store hours.</returns>
[HttpPost]
[Authorization(CommerceRoles.Anonymous, CommerceRoles.Customer, CommerceRoles.Device, CommerceRoles.Employee)]
public async Task<PagedResult<SampleDataModel.StoreDayHours>> GetStoreDaysByStore(IEndpointContext context, string StoreNumber)
{
QueryResultSettings queryResultSettings = QueryResultSettings.SingleRecord;
queryResultSettings.Paging = new PagingInfo(10);
var request = new GetStoreHoursDataRequest(StoreNumber) { QueryResultSettings = queryResultSettings };
var hoursResponse = await context.ExecuteAsync<GetStoreHoursDataResponse>(request).ConfigureAwait(false);
return hoursResponse.DayHours;
}
}
10.0.11 or earlier:
[ComVisible(false)]
public class StoreHoursController : CommerceControllerAsync<SampleDataModel.StoreDayHours, long>
{
/// <summary>
/// Gets the store hours for a given store.
/// </summary>
/// <param name="parameters">The parameters to this action.</param>
/// <returns>The list of store hours.</returns>
[HttpPost]
[CommerceAuthorization(CommerceRoles.Anonymous, CommerceRoles.Customer, CommerceRoles.Device, CommerceRoles.Employee)]
public async Task<PageResult<SampleDataModel.StoreDayHours>> GetStoreDaysByStore(ODataActionParameters parameters)
{
if (parameters == null)
{
throw new ArgumentNullException(nameof(parameters));
}
QueryResultSettings queryResultSettings = QueryResultSettings.SingleRecord;
queryResultSettings.Paging = new PagingInfo(10);
var request = new GetStoreHoursDataRequest((string)parameters["StoreNumber"]) { QueryResultSettings = queryResultSettings };
var hoursResponse = await this.CommerceRuntime.ExecuteAsync<GetStoreHoursDataResponse>(request, null).ConfigureAwait(false);
PagedResult<SampleDataModel.StoreDayHours> hours = hoursResponse.DayHours;
return this.ProcessPagedResults(hours);
}
}
Please let me know if this answers your question.