views:

115

answers:

1

Hello,

I have a custom asp.net control i created that allows you to bind an object to it, it functions kinda like a winform propertygrid.

Heres my issue: the control looks at the public properties and types of the class, if it detects a type of color it renders a color picker, etc.. Works great for classes that i create - however not so well when using an entity from link since its public properties are primitive types (int, string, bool).

I created a custom data type in sql2005 called color and i was hoping that it would carry over to the entity created by linq, but it sees it as its underlying type which is System.String

So, how do i create my entity types but have .NET see other types? Can i change the type before i return it to the caller?

ie:

public IEnumerable<SomeObject> GetSomething()
{
   MyEntity entity = new MyEntity("constr");
   var a = blahblah...;

   // Modify the types here?
   return a;

}
+1  A: 

On the LinqToSQL Designer you can change the property type of a field. Have you tried changing that?

You might also be able to write a partial class of that class and include a convert function that switches it to the correct type (IConvertable maybe?).

Hugoware