Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8658563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:47:54+00:00 2026-06-12T15:47:54+00:00

So the current situation is I have a program that is completely utilizing MEF.

  • 0

So the current situation is I have a program that is completely utilizing MEF. Now I want to make it utilize Rx as to allow it to scale to larger queries and allow the user to look over results as the various plugins return results. It is currently setup as such:

Workflow: Query => DetermineTypes => QueryPlugins => Results

Currently the code is all stored on GitHub if anyone needs to reference more than what I post below.
ALeRT on GitHub

The VS solution has a UI project (default StartUp Project), a PluginFramework Project, various TypePlugin Projects (think determining what the type is such as a URL, Email, File, Phone Number, etc) and also QueryPlugin Projects (perform xyz if the queryplugin supports the type that has been determined). All the results are displayed back into the UI by ways of a DataGrid that is being mapped to by the DefaultView of a DataTable.

I want to try and make the Rx portion as invisible to the plugins as possible. This is due to the fact that I do not want to make writing plugins complex for the few people that will. So I was thinking about taking the current Framework below:

public interface IQueryPlugin
{
    string PluginCategory { get; }
    string Name { get; }
    string Version { get; }
    string Author { get; }
    System.Collections.Generic.List<string> TypesAccepted { get; }
    string Result(string input, string type, bool sensitive);
}

and making the Result method into the following:

System.IObservable<string> Result(string input, string type, bool sensitive);

This would naturally require modifying the method that is calling the plugin which as it stands is:

                using (GenericParserAdapter parser = new GenericParserAdapter())
                {
                    using (TextReader sr = new StringReader(qPlugins.Result(query, qType, sensitive)))
                    {
                        Random rNum = new Random();

                        parser.SetDataSource(sr);
                        parser.ColumnDelimiter = Convert.ToChar(",");
                        parser.FirstRowHasHeader = true;
                        parser.MaxBufferSize = 4096;
                        parser.MaxRows = 500;
                        parser.TextQualifier = '\"';

                        DataTable tempTable = parser.GetDataTable();
                        tempTable.TableName = qPlugins.Name.ToString();
                        if (!tempTable.Columns.Contains("Query"))
                        {
                            DataColumn tColumn = new DataColumn("Query");
                            tempTable.Columns.Add(tColumn);
                            tColumn.SetOrdinal(0);
                        }

                        foreach (DataRow dr in tempTable.Rows)
                        {
                            dr["Query"] = query;
                        }

                        if (!resultDS.Tables.Contains(qPlugins.Name.ToString()))
                        {
                            resultDS.Tables.Add(tempTable);
                        }
                        else
                        {
                            resultDS.Tables[qPlugins.Name.ToString()].Merge(tempTable);
                        }
                        pluginsLB.DataContext = resultDS.Tables.Cast<DataTable>().Select(t => t.TableName).ToList();
                    }
                }

So at this point I’m stuck as to how to make this work. There doesn’t seem to be good documentation on how to integrate MEF with Rx. My assumption is to make the following change

using (TextReader sr = new StringReader(qPlugins.Result(query, qType, sensitive).Subscribe()))

but this isn’t going to work. So any help on making these changes would be greatly appreciated. If you have other suggestions regarding my code, please let me know. I do this as a hobby so I know my code surely isn’t up to snuff for most people.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:47:55+00:00Added an answer on June 12, 2026 at 3:47 pm

    Would this work for you:

    IObservable<DataTable> q =
        from text in qPlugins.Result(query, qType, sensitive)
        from tempTable in Observable.Using(
            () => new GenericParserAdapter(),
            parser => Observable.Using(
                () => new StringReader(text),
                sr => Observable .Start<DataTable>(
                    () =>
                    {
                        var rNum = new Random();
    
                        parser.SetDataSource(sr);
                        parser.ColumnDelimiter = Convert.ToChar(",");
                        parser.FirstRowHasHeader = true;
                        parser.MaxBufferSize = 4096;
                        parser.MaxRows = 500;
                        parser.TextQualifier = '\"';
    
                        var tempTable = parser.GetDataTable();
                        tempTable.TableName = qPlugins.Name.ToString();
                        if (!tempTable.Columns.Contains("Query"))
                        {
                            DataColumn tColumn = new DataColumn("Query");
                            tempTable.Columns.Add(tColumn);
                            tColumn.SetOrdinal(0);
                        }
    
                        foreach (DataRow dr in tempTable.Rows)
                            dr["Query"] = query;
    
                        return tempTable;
                    })))
        select tempTable;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Current situation: Have a timesheet that allows the user to enter their leave, TOIL,
Here's my current situation: I have a NSMutableArray named dictKeyArray which I assign a
let me explain my current situation i have a SharePoint site lets say it
My current situation is: I have to read a file and put the contents
Here is my current situation; I am a near complete regexp illiterate, and have
First, I'd like to describe my current situation. I have an RDLC whose data
The current situation is that topics are sorted by 3 main categories. There is
I am using Asp.Net/C# in my application.My current situation is that I am using
Let's say I have a program(C++, for example) that allocates multiple objects, never bigger
A little bit about my current situation: I have a decent knowledge of OOP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.