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

  • SEARCH
  • Home
  • 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 524817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:36:27+00:00 2026-05-13T08:36:27+00:00

Using information from some of the questions here on generic views, I have created

  • 0

Using information from some of the questions here on generic views, I have created an MVC app that reads .dlls from its own /bin directory and builds the UI on the fly. InputBuilder partial views helped a lot. I also made a ControllerFactory, after the advice from here and elsewhere.

My problem is, while everything is working OK and reflection is recognizing the types I’m passing around, GetType() requires the full assembly qualified name (‘scuse the code, still prototyping):

public IController CreateController(RequestContext requestContext, string controllerName)
        {
            Type controllerType = null;
            Type genericType;

            //controllerName coming in as full assembly-qualified path

            Type baseControllerType = typeof(CoreDataController<>);

                genericType = Type.GetType(controllerName);
                if (genericType != null)
                { 
                    controllerType = baseControllerType.MakeGenericType(genericType); 
                }
            if (controllerType != null)

            { 
                return Activator.CreateInstance(controllerType) as IController; 
            }

            return controllerType;

        }

This makes my urls look like this:

http://localhost:1075/CoreData.Plans,%20PlansLib,%20Version=1.0.0.0,%20Culture=neutral,%20PublicKeyToken=null/Create

Obviously sub-optimal.

What I’d like is http://localhost:1075/CoreData.Plans/Create

or even better:

http://localhost:1075/Plans/Create

Should I store a dictionary accessible to my controller on Application_Start() mapping short names to fully-qualified names? Is there a feature of Reflection I’m missing that would solve this problem?

  • 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-05-13T08:36:27+00:00Added an answer on May 13, 2026 at 8:36 am

    I think your idea of a dictionary mapping pretty names to types would be good. You may want to try putting attributes on your classes, then at startup, you can use reflection to extract out the attributes for building the dictionary:

    [UrlName("my-class-name")]
    public class MyClassName
    {
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fetching some information from mysql database and I am displaying it using
I'm working in Django, and using urllib2 and simplejson to parse some information from
Using a form I am inserting the information from 3 text fields and 2
My application scrapes information from various sites using Mechanize. Naturally, each site requires custom
I want to extract information from Twitter using Python. There is a page with
Im using PHP to output the category information from an RSS feed: foreach(item_category()) as
I am using a framework to get information from the network. The problem is
i want to fetch information from the database using objects. i really like this
In my application I load information from several (6-10) websites using NSXMLParser and then
I am using DataTables with server-side processing with information from a form. On form

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.