Ejemplo n.º 1
0
        public static string GetPropertyType(string type, ISimRepository simRepository)
        {
            string typeFromCore = GetPropertyTypeFromCore(type, simRepository);

            if (typeFromCore != null)
            {
                return(typeFromCore);
            }

            switch (type)
            {
            case "String":
                return(String.FullName);

            case "Integer":
                return(Integer.FullName);

            case "Double":
                return(Double.FullName);

            case "Boolean":
                return(Boolean.FullName);

            case "DateTime":
                return(DateTime.FullName);

            default:
                throw new ArgumentException($"Could not recognize property node type of {type}");
            }
        }
Ejemplo n.º 2
0
 public NewDynamicNodeCommand(ISimRepository repository, string nameSpace, string name, bool isVisible)
 {
     this.repository = repository ?? throw new ArgumentNullException(nameof(repository));
     this.nameSpace  = nameSpace;
     this.name       = name;
     this.isVisible  = isVisible;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Collection of applicable outwards/inwards relations on the Node
        /// </summary>
        /// <param name="repository"></param>
        /// <returns></returns>
        public IReadOnlyCollection <Relation> Relations(ISimRepository repository)
        {
            List <Relation> relations = new List <Relation>();

            relations.AddRange(InwardsRelations(repository));
            relations.AddRange(OutwardsRelations(repository));
            return(relations.AsReadOnly());
        }
Ejemplo n.º 4
0
 public NewDynamicRelationCommand(ISimRepository repository, string nameSpace, string name,
                                  IEnumerable <string> originTypes, IEnumerable <string> targetTypes)
 {
     this.repository  = repository ?? throw new ArgumentNullException(nameof(repository));
     this.nameSpace   = nameSpace;
     this.name        = name;
     this.originTypes = originTypes;
     this.targetTypes = targetTypes;
 }
Ejemplo n.º 5
0
 public DbService(ICustomerRepository customer, IRoleRepository role, IGroupRepository group, ISimRepository sim, IOrderRepository order, IStaffRepository staff)
 {
     this._customer = customer;
     this._role     = role;
     this._group    = group;
     this._sim      = sim;
     this._staff    = staff;
     this._order    = order;
 }
Ejemplo n.º 6
0
 public NewDynamicPropertyCommand(ISimRepository repository, DynamicGraphObject owner, string name,
                                  string dataType, bool isRequired,
                                  bool isUserInput, bool isFirstLevelProperty)
 {
     this.Repository           = repository ?? throw new ArgumentNullException(nameof(repository));
     this.Owner                = owner ?? throw new ArgumentNullException(nameof(owner));
     this.Name                 = name;
     this.DataType             = dataType;
     this.IsRequired           = isRequired;
     this.IsUserInput          = isUserInput;
     this.IsFirstLevelProperty = isFirstLevelProperty;
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        private static string GetPropertyTypeFromCore(string type, ISimRepository simRepository)
        {
            System.Reflection.Assembly core = System.Reflection.Assembly.GetAssembly(typeof(Relation));
            Type typeFromCore = core.GetType(type);

            if (typeFromCore != null && typeFromCore.BaseType.Equals(typeof(Relation)))
            {
                return(typeFromCore.FullName);
            }
            else
            {
                ISimObject typeFromCurrentRepos = simRepository.Get(a => a is DynamicRelation && (a as DynamicRelation).Name.Equals(type, StringComparison.OrdinalIgnoreCase));
                if (typeFromCurrentRepos != null)
                {
                    return(string.Format("{0}.{1}", (typeFromCurrentRepos as DynamicRelation).Namespace, (typeFromCurrentRepos as DynamicRelation).Name));
                }
            }

            return(null);
        }
Ejemplo n.º 9
0
 static void Main(string[] args)
 {
     repository = new Neo4jRepository();
     var x = repository.GetAll(a => a is Node);
 }
Ejemplo n.º 10
0
 public SimService(ISimRepository SimRepository)
 {
     this._simRepository = SimRepository;
 }
Ejemplo n.º 11
0
 public CodeFactory(ISimRepository repository) : this(repository.GetAll().Select(c => c as DynamicObject))
 {
 }
Ejemplo n.º 12
0
 public static void GetAllValidTypes(ISimRepository simRepository, out IEnumerable <string> regularTypes, out IEnumerable <string> nodeTypes)
 {
     regularTypes = GetAllValidRegularTypes();
     nodeTypes    = GetAllValidNodeTypes(simRepository);
 }
Ejemplo n.º 13
0
 public CompileRepositoryCommand(ISimRepository repository)
 {
     this.repository = repository ?? throw new ArgumentNullException(nameof(repository));
 }
Ejemplo n.º 14
0
 /// <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());
 }
Ejemplo n.º 15
0
 public SomeController(ISimRepository simRepository)
 {
     this.simRepository = simRepository;
 }
Ejemplo n.º 16
0
 public LoadRepositoryAsJson(ISimRepository repository, string nameSpace)
 {
     this.repository = repository ?? throw new ArgumentNullException(nameof(repository));
     this.nameSpace  = nameSpace;
 }
Ejemplo n.º 17
0
 public PrintCurrentRepository(ISimRepository repository)
 {
     this.repository = repository ?? throw new ArgumentNullException(nameof(repository));
 }
Ejemplo n.º 18
0
        public DynamicProperty(string nameSpace, string propertyName, string valueType,
                               bool isRequired, bool isUserInput, bool isFirstLevelProperty, ISimRepository simRepository)
        {
            try
            {
                Namespace = nameSpace.ValidateNullOrWhitespace(nameof(nameSpace));
                Name      = propertyName.ValidateNullOrWhitespace(nameof(propertyName));
                ValueType = DynamicPropertyType.GetPropertyType(valueType, simRepository);
            }
            catch (ArgumentException ex)
            {
                throw ex;
            }

            IsRequired           = isRequired;
            IsUserInput          = isUserInput;
            IsFirstLevelProperty = isFirstLevelProperty;
        }
Ejemplo n.º 19
0
 public NewRelationCommand(ISimRepository repository, Node origin, Node target)
 {
     this.repository = repository ?? throw new ArgumentNullException(nameof(repository));
     this.origin     = origin ?? throw new ArgumentNullException(nameof(origin));
     this.target     = target ?? throw new ArgumentNullException(nameof(target));
 }