public void Setup(object owner, VariableSchema schema, VariableSet variables) { var mapping = GetMapping(owner.GetType(), schema); var listCount = mapping.Properties.Count; if (schema != null && variables != null) { listCount++; } var lists = new IMappedVariableList[listCount]; for (var i = 0; i < mapping.Properties.Count; i++) { lists[i] = new PropertyList(owner, mapping.Properties[i]); } // variable initializers may need the map set to access other variables _map = mapping.Map; _lists = lists; if (variables != null) { if (schema != null) { if (owner is IVariableListener listener) { lists[listCount - 1] = new VariableListener(listener, variables); } else { lists[listCount - 1] = variables; } variables.Setup(schema, owner as IVariableStore); } else { variables.Clear(); } } }
public VariableListener(IVariableListener listener, IMappedVariableList list) { _listener = listener; _list = list; }