Код: Выделить всё
Microsoft.AspNet.ODataЯ думаю, что я довольно близко, но что -то все еще не хватает - это то, что у меня есть (в классе, в этом возрасте. T ):
Код: Выделить всё
var modelBuilder = new ODataModelBuilder();
var typeConfig = modelBuilder.EntitySet("Items").EntityType;
// Now, I call typeConfig.HasKey() for one or more properties (depending on `T`),
// as for some reason, the properties marked with [Key] are not automatically
// recognized.
var edm = modelBuilder.GetEdmModel();
var eSet = edm.EntityContainer.FindEntitySet("Items");
// passing a hard-coded sample filter here
var parser = new ODataQueryOptionParser(edm, new ODataPath(new EntitySetSegment(eSet)), new Dictionary { { "$filter", "Id eq 5" } });
var filterClause = parser.ParseFilter();
var svcCollection = new ServiceCollection();
svcCollection.AddOData();
svcCollection.AddODataQueryFilter();
svcCollection.AddTransient();
svcCollection.AddTransient();
svcCollection.AddSingleton(edm);
var binder = new FilterBinder(svcCollection.BuildServiceProvider());
// I hope this will return what I'm after.
var expr = binder.Bind(filterClause.Expression);
Что мне нужно сделать, чтобы исправить это? Ответ.)
Подробнее здесь: https://stackoverflow.com/questions/796 ... expression
Мобильная версия