private void ValidateDuplicatedSourceAndArea(Structure structure) { var totalgrouped = structure.WorkFlow .GroupBy(x => new { x.Area, x.SourceState }) .Where(grp => grp.Count() > 1) .Select(x => new { Key = x.Key, List = x.ToList() }); foreach (var item in totalgrouped) { string message = string.Join(",", item.List.Select(x => x.Id).ToList()); throw new DuplicatedNodeException(string.Format("There are duplicated entries for Ids: {0}", message)); } }
public WorkFlowContext() { node = WorkFlow.Singleton.WorkFlowSingleton.Instance().GetStructure(); }
public void Validate(Structure structure) { ValidateDuplicatedSourceAndArea(structure); }
private WorkFlowSingleton() { string json = dalc.GetJson(); structure = JsonConvert.DeserializeObject<Structure>(json); WorkFlowConfiguration.Binder.Setting.Validator.Validate(structure); }