Hidden gem: BuildManager.GetType

I’ve been digging through the ObjectDataSource today and I was trying to figure out how they created the datasource instance from the type name.

Now some clever reader might say “I know, I know, Type.GetType(string)”… But that’s wrong..
Type.GetType(string) requires full type names with assembly name and the whole shebang.

The ObjectDataSource is able to create instances w/o all that information.
So after a while of digging I found a precious gem, hidden in System.Configuration:
“BuildManager.GetType(string)”

Very very nice :-)

I can now inherit ObjectDataSource and fetch the type via buildmanager and then call NAspect to proxy the type and get an AOP enabled datasource.

Thats all for now, just wanted to share this one :-)

2 Comments

  1. ilanchelian's avatar ilanchelian says:

    it seems that it is under System.Web.Compilation.

  2. Johan's avatar Johan says:

    Hi, when come LINQ to NPersist be finished? It’s so cool!

Leave a Comment