a query builder
- intro
- getting started
- more information
oracular is a little query builder based on the specification pattern and oriented towards business users. The goal is to refactor business logic in such a way that it can be easily stored and used to drive the execution of business applications.
Install the package with NuGet.
NuGet Install-Package Oracular
Load and check your config file.
var path = HostingEnvironment.MapPath(@"~/App_Data/oracular.json");
var config = OracularConfig.LoadFromFile(path);
config.Check();
Serialize some spec queries.
var customers = config.GetSpec("isCustomerAccount");
var customersSql = spec.ToSql();
var managers = config.GetSpec("isManagerUser");
var managersSql = spec.ToSql();
Check a new spec against the config file.
var specSource = "isCustomerAccount(Account) AND isManagerUser(Account.Owner)";
config.CheckSpec("Account", specSource);
Add the new spec to the live configuration.
config.AddSpec("isCustomerOwnedByManager", "Account", specSource);
Export the updated configuration file.
var updatedJson = config.Export();
See the oracular project repository for documentation.