MicroRuleEngine
MicroRuleEngine copied to clipboard
how to serialize data row rule
DataRule.Create
I used this example and want to serialize this rule . Getting error.
I'll have a Pull Request for this soon, but to get you working now:
In MRE.cs, add the serializarion attributes to DataRule:
[DataContract]
public class DataRule : Rule
{
[DataMember]
public string Type { get; set; }
Include the "known type" in the serializer:
var serializer = new DataContractJsonSerializer(typeof(DataRule), new[] { typeof(Rule) });
Also, if Column2 is an int, make it that in the rule:
Rule rule = DataRule.Create("Column2", mreOperator.Equal, 123)
& DataRule.Create("Column1", mreOperator.Equal, "Test");
Yes , that works for me.. Thank you so much.
On Thu, Aug 6, 2020 at 5:02 PM James Curran [email protected] wrote:
I'll have a Pull Request for this soon, but to get you working now:
In MRE.cs, add the serializarion attributes to DataRule:
[DataContract] public class DataRule : Rule { [DataMember] public string Type { get; set; }
Include the "known type" in the serializer:
var serializer = new DataContractJsonSerializer(typeof(DataRule), new[] { typeof(Rule) });
Also, if Column2 is an int, make it that in the rule:
Rule rule = DataRule.Create("Column2", mreOperator.Equal, 123) & DataRule.Create("Column1", mreOperator.Equal, "Test");
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/runxc1/MicroRuleEngine/issues/25#issuecomment-670190115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQQ435YCQIRFIA26TWLCXB3R7MK6DANCNFSM4PW52DOA .