예제 #1
0
        public IDataType GetType(string typeName)
        {
            Type foundType = null;

            if (typeName.EndsWith("]]"))
            {
                var regex   = new Regex(@"^(?<collectionType>.+?)\[\[(?<paramterTypes>.+?)\]\]$");
                var matches = regex.Matches(typeName);

                if (matches.Count == 1)
                {
                    var parameters    = matches[0].Groups["paramterTypes"].Value;
                    var valueTypeName = matches[0].Groups["collectionType"].Value;

                    var valueType = typeFinder.GetType(valueTypeName);

                    if (valueType != null)
                    {
                        var paramterTypes = GetParamterTypes(parameters);
                        foundType = valueType.GetTargetType().MakeGenericType(paramterTypes);
                    }

                    if (foundType != null)
                    {
                        typesCache.Add(typeName, foundType);
                    }
                }
            }

            return(foundType == null ? null : dataTypeFactory.Create(foundType));
        }
예제 #2
0
        public IDataType GetType(string typeName)
        {
            var foundType = seedAssembly.GetType(typeName);

            if (foundType != null)
            {
                typesCache.Add(typeName, foundType);
                return(dataTypeFactory.Create(foundType));
            }
            return(null);
        }
예제 #3
0
        public IDataType GetType(string typeName)
        {
            var assemblyNameFilter = new PassOnceNameFilter();

            var foundType = SearchReferencedAssemblies(typeName, seedAssembly, assemblyNameFilter);

            if (foundType != null)
            {
                typesCache.Add(typeName, foundType);
            }

            return(dataTypeFactory.Create(foundType));
        }
예제 #4
0
 public void Add(string typeName, Type type)
 {
     cachedTypes.Add(typeName, dataTypeFactory.Create(type));
 }
예제 #5
0
        public bool IsSatisfiedBy(string dataTypeName, string value, string comparison, string comparisonValue)
        {
            var result = true;

            foreach (var argumentValueItem in value.Split(Separator, StringSplitOptions.RemoveEmptyEntries))
            {
                var argumentDataType = _dataTypeFactory.Create(dataTypeName, argumentValueItem);

                foreach (var constraintValueItem in comparisonValue.Split(Separator, StringSplitOptions.RemoveEmptyEntries))
                {
                    var comparisonDataType = _dataTypeFactory.Create(dataTypeName, constraintValueItem);

                    var comparisionResult = argumentDataType.CompareTo(comparisonDataType);

                    switch (comparison.ToLowerInvariant())
                    {
                    case "==":
                    {
                        result = comparisionResult == 0;

                        break;
                    }

                    case "!=":
                    {
                        result = comparisionResult != 0;

                        break;
                    }

                    case ">=":
                    {
                        result = comparisionResult == 0 || comparisionResult == 1;

                        break;
                    }

                    case ">":
                    {
                        result = comparisionResult == 1;

                        break;
                    }

                    case "<=":
                    {
                        result = comparisionResult == -1 || comparisionResult == 0;

                        break;
                    }

                    case "<":
                    {
                        result = comparisionResult == -1;

                        break;
                    }

                    case "in":
                    {
                        throw new NotImplementedException();
                    }
                    }

                    if (!result)
                    {
                        break;
                    }
                }

                if (!result)
                {
                    break;
                }
            }

            return(result);
        }