views:

80

answers:

2

I need to use some of the Microsoft.SqlServer.Types library internal classes. This is a .NET dll, which is easily disassembled to the language of my choice.

So far I could copy its code to my application, but this probably makes my application legally unsuitable for distribution (I haven't read the MS Sql Server 2008 licensing agreement, but I guess I can't do that).

There is any way to force my application to be Friendly of the dll? As far as I know the InternalsVisibleTo attribute is under strict control of the assembly developer, in this case Microsoft.

+1  A: 

This is a relatively common problem - there are some useful classes within the runtime that are marked internal and are otherwise unavailable for use.

Use of [InternalsVisibleTo] is, as you mention, entirely under control of the assembly developer - as this attribute is intended to allow co-developed assemblies to share code that isn't visible to the unwashed masses.

Copying code verbatim would almost certainly be a problem as well.

What you can do (and remember IANAL - I am not a lawyer) is to develop your own variation, giving full credit to the original Assembly.

Bevan
Thank you for confirming my suspicions.
Jader Dias
The chinese wall, clean room, development would certainly be legal. But for that you need 2 persons. http://en.wikipedia.org/wiki/Chinese_wall#Reverse_engineering
Jader Dias
+2  A: 

You could use reflection (ie the Activator class) to access and use hidden (private, internal) types. While this will not provide fantastic performance, it may be an option.

Ash
I think that it is somewhat related to the Accessor classes created automatically by the Visual Studio's Unit Test Wizard
Jader Dias
Yes, most unit test frameworks use reflection in the "test runner" that creates your test fixtures and runs test methods. I know nUnit does this.
Ash