-
Notifications
You must be signed in to change notification settings - Fork 8
New Data Source Provider ‐ How To
Luís Garcês edited this page Oct 1, 2023
·
1 revision
In case you need to support other databases, you'll have to implement your own data source provider logic. You should implement IRulesDataSource<TContentType, TConditionType>
interface and use it on rules engine builder.
public interface IRulesDataSource<TContentType, TConditionType>
{
Task AddRuleAsync(Rule<TContentType, TConditionType> rule);
Task<IEnumerable<Rule<TContentType, TConditionType>>> GetRulesAsync(TContentType contentType, DateTime dateBegin, DateTime dateEnd);
Task<IEnumerable<Rule<TContentType, TConditionType>>> GetRulesByAsync(RulesFilterArgs<TContentType> rulesFilterArgs);
Task UpdateRuleAsync(Rule<TContentType, TConditionType> rule);
}
You'll have to map each condition type defined by you to a data type on your rules data source. The ones available are:
- Integer
- Decimal
- String
- Boolean
For your guidance, check Mongo DB implementation: MongoDbProviderRulesDataSource.cs