예제 #1
0
        protected virtual StructureDiscoveryCommand InstantiateCommand(AbstractItem item)
        {
            var factory = discoveryProvider.Instantiate(item.GetConnectionString());

            var target  = BuildTarget(item);
            var filters = BuildFilters(item);

            var command = factory.Instantiate(target, TargetType.Object, filters);

            return(command);
        }
예제 #2
0
        internal MetadataDiscoveryRequest Build(AbstractItem item, MetadataDiscoveryRequestType type)
        {
            var properties = new string[] { "Perspective", "Dimension", "Hierarchy", "Level", "Property", "MeasureGroup", "DisplayFolder", "Measure", "Table", "Column" };

            IFilter filter  = null;
            var     filters = new List <IFilter>();

            foreach (var property in properties)
            {
                filter = BuildCaptionFilter(item, property);
                if (filter != null)
                {
                    filters.Add(filter);
                }
            }

            var target = GetTarget(item);

            filter = BuildCaptionFilterForCaptionProperty(item, target);
            if (filter != null)
            {
                filters.Add(filter);
            }

            var connectionString = item.GetConnectionString();

            var factory = new DiscoveryRequestFactory();
            MetadataDiscoveryRequest request = null;

            switch (type)
            {
            case MetadataDiscoveryRequestType.Direct:
                request = factory.BuildDirect(connectionString, target, filters);
                break;

            case MetadataDiscoveryRequestType.Relation:
                target  = GetTargetRelation(item);
                request = factory.BuildRelation(connectionString, target, filters);
                break;

            default:
                break;
            }
            return(request);
        }