mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
// ==========================================================================
|
|
// EdmModelExtensions.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using Microsoft.OData.Edm;
|
|
using Microsoft.OData.UriParser;
|
|
|
|
namespace Squidex.Domain.Apps.Read.MongoDb.Contents.Visitors
|
|
{
|
|
public static class EdmModelExtensions
|
|
{
|
|
public static ODataUriParser ParseQuery(this IEdmModel model, string query)
|
|
{
|
|
query = query ?? string.Empty;
|
|
|
|
var path = model.EntityContainer.EntitySets().First().Path.Path.Split('.').Last();
|
|
|
|
if (query.StartsWith("?"))
|
|
{
|
|
query = query.Substring(1);
|
|
}
|
|
|
|
var parser = new ODataUriParser(model, new Uri($"{path}?{query}", UriKind.Relative));
|
|
|
|
return parser;
|
|
}
|
|
}
|
|
}
|
|
|