我在 MongoDB 中有以下文档格式
文件1:
{
"_id" : ObjectId("5b0d30ae942267c0c8f6229d"),
"Expression" : "[tag] = 'Druck1' && [status]='OK'",
"Name" : "Druck1 is running",
"Actions" : [
{
"TemplateName" : "Warning",
"Tags" : "[tag]",
"Roles" : [
"Group_AdUser",
"Group_FieldServiceCoordinator",
"Group_FieldServiceTechnician",
"Group_Roaster",
"Group_ServiceAdmin",
"Group_ServiceManager",
"Group_ServiceSales",
"Group_TSCUser",
"Group_WorkshopRepairCoordinator"
],
"IsActive" : true,
"SequenceNo" : 0,
"Type" : "EventMessageAction"
}
],
"IsActive" : true,
"TargetUsers" : null,
"TargetGroups" : null,
"Type" : "Rule"
}
文件2:
{
"_id" : ObjectId("5b0bc01fcd8d2966e0fdf2f2"),
"Expression" : "HasProperty('category') && [category] = 'Temperature'",
"Name" : "RTF Machine Temperature (History Data)",
"Actions" : [
{
"Table" : "[machinename]",
"Key" : "'RTF'",
"Value" : "[value]",
"Timestamp" : "[timestamp]",
"ExpirationDate" : "[timestamp]",
"Icon" : "''",
"Color" : "''",
"Text" : "''",
"Category" : "[category]",
"IsActive" : true,
"Type" : "HistoryDataAction",
"SequenceNo" : 0
}
],
"IsActive" : true,
"TargetUsers" : null,
"TargetGroups" : null,
"Type" : "Rule"
}
有什么办法,我可以通过我的实体获取上述记录,如下所示:
规则实体:
[DataContract]
public abstract class Rule
{
[DataMember]
public string Expression { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public IEnumerable<Action> Actions { get; set; }
[DataMember]
public bool IsActive { get; set; }
}
慕勒3428872
相关分类