/// <summary>
        /// The format of the query information and the desired UI will usually depend on the Linq to SQLq provider
        /// used by the query. 
        /// Therefore in this general query visualizer we only read the assembly and class for the specific
        /// query visualizer from the Stream and call the method "Display" on this class, which in turn will
        /// read the query information and show the UI.         
        /// </summary>
        /// <param name="windowService"> used to display the UI </param>
        /// <param name="objectProvider"> used to retrieve the data (as Stream) from the visualizer proxy</param>
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            Stream rawStream = objectProvider.GetData();

            //call visualizer to serialize query info
            Visualizer qv = new Visualizer();

            qv.Display(windowService, rawStream);
        }
        /// <summary>
        /// The unit tests will use this static version
        /// </summary>
        /// <param name="target"></param>
        /// <param name="outgoingData"></param>
        public static void SerializeTheQuery(object target, Stream str)
        {
            // get query
            IQueryable query = target as IQueryable;
            if (query == null) {
                Error(str, "Query visualizer invoked on non-IQueryable target.");
                return;
            }

            //get provider
            Type tQueryImpl = query.GetType();
            FieldInfo fiContext = tQueryImpl.GetField("context", BindingFlags.NonPublic | BindingFlags.Instance);
            if (fiContext == null) {
                Error(str, "Query field 'context' not found in type " + tQueryImpl.ToString() + ".");
                return;
            }

            Object objProvider = fiContext.GetValue(query);
            if (objProvider == null) {
                Error(str, "Query field 'context' returned null.");
                return;
            }

            System.Data.Linq.DataContext dataContext = objProvider as System.Data.Linq.DataContext;
            if (dataContext == null) {
                Error(str, "Query is not against a DataContext.");
                return;
            }

            //call visualizer to serialize query info
            //object objVisualizer = Activator.CreateInstance(providerVisualizerType);
            //SourceChooser iVisualizer = objVisualizer as IProviderQueryVisualizer;
            Visualizer objVisualizer = new Visualizer();
            BinaryFormatter formatter = new BinaryFormatter();
            objVisualizer.StreamQueryInfo(dataContext, query, str);
        }