Saturday, July 14, 2007

The SubSonic Drive-Through Window

This post has been moved to the IT Crossing blog.  You can view it here.

5 comments:

Don Worthley said...

I forgot to mention that I ran some quick tests to determine the performance hit for using reflection to load the ActiveRecord objects. I found that while there was a half second or so performance hit the first time the page was loaded, subsequent hits to the page showed only an additional 1 or 2 milliseconds. For most situations, this kind of overhead is negligible.

Rob said...

Don thanks for this article! I've been doing a lot of work with reflection of late and I think, in terms of perf, you can cache the type that you've called into a static collection set, then search it first before calling the Assembly bits.

Anyway - this is GREAT stuff and I'd love to add it to the core!

Don Worthley said...

Thanks for the feedback, Rob! Feel free to add anything that you find useful.

Unknown said...

I'm not very smart, and don't get a lot of things but what exactly does this enable you to do ?

Which can't be done through the normal way of doing things ?

Don Worthley said...

Hi Mischa,

Let's say you are writing a component that will show data from one of your SubSonic Active Record objects. This component won't be very reusable if you hard code the component to use the Customer class or the Customer Controller. What would be great is to have the ability to write the component to use any SubSonic object generically. This would be possible if there were some type of base interface that didn't use Generics which provided access to the functionality common to all active record objects. When I wrote the article, this wasn't available in SubSonic.

When I started thinking more about how this could be implemented, I realized that reflection would be a great way to solve this problem and I was pleasantly surprised to find that there wasn't the performance penalty I thought there would be when using reflection.

HTH,

Don