/// <summary> /// 根据XML获取对应级联规则 /// </summary> /// <param name="entityElement"></param> /// <returns></returns> public void SetCascadeRule(XElement entityElement) { if (entityElement.Attribute("Event") != null) { switch (entityElement.Attribute("Event").Value) { case "Insert": this.Event = StorageType.Insert; break; case "Update": this.Event = StorageType.Update; break; case "Delete": this.Event = StorageType.Delete; break; default: this.Event = StorageType.None; break; } } if (entityElement.Attribute("Time") != null) { switch (entityElement.Attribute("Time").Value) { case "Before": this.Time = CascadeTimeType.Before; break; case "After": this.Time = CascadeTimeType.After; break; default: this.Time = CascadeTimeType.None; break; } } this.Condition = new ConditionRule(entityElement.Attribute("Condition") != null ? entityElement.Attribute("Condition").Value : ""); this.Remark = entityElement.Attribute("Remark") != null?entityElement.Attribute("Remark").Value : ""; this.SetOperateRule(entityElement); }
/// <summary> /// 根据XML获取对应的判断规则 /// </summary> /// <param name="entityElement"></param> /// <returns></returns> public void SetIfRule(XElement entityElement) { this.Condition = new ConditionRule(entityElement.Attribute("Condition") != null ? entityElement.Attribute("Condition").Value : ""); this.SetOperateRule(entityElement); }