CK-Yong / gaip-net

Library for implementing Google Api Improvement Proposals in C#
MIT License
2 stars 1 forks source link

Feat: Added black- and whitelisting functionality #31

Closed CK-Yong closed 2 years ago

CK-Yong commented 2 years ago

This is a feature as described in #11

var filterResult = FilterBuilder.FromString("bar=\"baz\"")
    .UseAdapter(new MongoFilterAdapter<MyClass>())
    .UseWhitelist(x => x.Foo)
    .Build();

filterResult.IsQueryAllowed == false;
myCollection.Find(filterResult.Value); // Throws InvalidOperationException

var filterResult = FilterBuilder.FromString("foo=\"baz\"")
    .UseAdapter(new MongoFilterAdapter<MyClass>())
    .UseBlacklist(x => x.Foo)
    .Build();

filterResult.IsQueryAllowed == false;
myCollection.Find(filterResult.Value); // Throws InvalidOperationException