private static IEnumerable <string> GetAllValidNodeTypes(ISimRepository simRepository) { var result = new List <string>(); // From Core System.Reflection.Assembly core = System.Reflection.Assembly.GetAssembly(typeof(Relation)); result.AddRange(core.GetTypes() .Where(a => a.Name.Equals("Node", StringComparison.OrdinalIgnoreCase)) .Select(a => a.Name)); // From Repository result.AddRange(simRepository .GetAll(a => a is DynamicRelation) .Select(a => (a as DynamicRelation).Name)); return(result); }
public void Execute() { if (!CanExecute()) { throw new OperationCanceledException($"{GetType().Name} cannot be excuted"); } JsonSerializer serializer = new JsonSerializer(); var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), $@"SIM\Json\{nameSpace}.json"); TextWriter writer = new StreamWriter(path); JsonSerializerSettings settings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }; var text = JsonConvert.SerializeObject(repository.GetAll(), settings); writer.Write(text); writer.Close(); }
/// <summary> /// Collection of applicable outwards relations on the Node /// </summary> /// <param name="repository"></param> /// <returns></returns> public IReadOnlyCollection <Relation> OutwardsRelations(ISimRepository repository) { return(repository.GetAll(a => a is Relation && ((a as Relation).Origin == this)) .Select(a => a as Relation) .ToList().AsReadOnly()); }
static void Main(string[] args) { repository = new Neo4jRepository(); var x = repository.GetAll(a => a is Node); }
private void PrintRelations() { var all = repository.GetAll(a => a is DynamicRelation); }
public CodeFactory(ISimRepository repository) : this(repository.GetAll().Select(c => c as DynamicObject)) { }