(function () {
    var endpointSelector = new DevExpress.EndpointSelector(Partials.config.endpoints);

    var serviceConfig = $.extend(true, {}, Partials.config.services, {
        odata: {
            url: endpointSelector.urlFor("odata"),

            errorHandler: handleServiceError
        }
    });

    function handleServiceError(error) {
        if (window.WinJS) {
            try {
                new Windows.UI.Popups.MessageDialog(error.message).showAsync();
            } catch (e) {
                // Another dialog is shown
            }
        } else {
            alert(error.message);
        }
    }

    // Enable partial CORS support for IE < 10    
    $.support.cors = true;

    Partials.odata = new DevExpress.data.ODataContext(serviceConfig.odata);
}());