예제 #1
0
        public SearchResults get_search_Type_Value(StructureMapSearch search)
        {
            var results = new SearchResults
            {
                search      = search,
                pluginTypes = new PluginTypeDTO[0],
                instances   = new InstanceDTO[0]
            };

            switch (search.Type)
            {
            case "Assembly":
                var assemblyName = search.Value.Replace(".dll", "");

                results.pluginTypes =
                    _container.Model.PluginTypes.Where(x => x.PluginType.Assembly.GetName().Name == assemblyName)
                    .Select(x => new PluginTypeDTO(x)).ToArray();

                break;

            case "Plugin-Type":
                results.pluginTypes = _container.Model
                                      .PluginTypes.Where(x => x.PluginType.GetFullName() == search.Value)
                                      .Select(x => new PluginTypeDTO(x))
                                      .ToArray();


                break;

            case "Namespace":
                results.pluginTypes = _container.Model
                                      .PluginTypes.Where(x => x.PluginType.Namespace == search.Value)
                                      .Select(x => new PluginTypeDTO(x))
                                      .ToArray();
                break;

            case "Returned-Type":
                results.instances = instances().Where(x => x.ReturnedType.GetFullName() == search.Value)
                                    .Select(x => new InstanceDTO(x)).ToArray();

                break;

            default:
                throw new NotImplementedException("DOES NOT COMPUTE");
            }

            return(results);
        }
        public SearchResults get_search_Type_Value(StructureMapSearch search)
        {
            var results = new SearchResults
            {
                search = search,
                pluginTypes = new PluginTypeDTO[0],
                instances = new InstanceDTO[0]
            };

            switch (search.Type)
            {
                case "Assembly":
                    var assemblyName = search.Value.Replace(".dll", "");

                    results.pluginTypes =
                        _container.Model.PluginTypes.Where(x => x.PluginType.Assembly.GetName().Name == assemblyName)
                            .Select(x => new PluginTypeDTO(x)).ToArray();

                    break;

                case "Plugin-Type":
                    results.pluginTypes = _container.Model
                        .PluginTypes.Where(x => x.PluginType.GetFullName() == search.Value)
                        .Select(x => new PluginTypeDTO(x))
                        .ToArray();

                    break;

                case "Namespace":
                    results.pluginTypes = _container.Model
                        .PluginTypes.Where(x => x.PluginType.Namespace == search.Value)
                        .Select(x => new PluginTypeDTO(x))
                        .ToArray();
                    break;

                case "Returned-Type":
                    results.instances = instances().Where(x => x.ReturnedType.GetFullName() == search.Value)
                        .Select(x => new InstanceDTO(x)).ToArray();

                    break;

                default:
                    throw new NotImplementedException("DOES NOT COMPUTE");
            }

            return results;
        }