TypeConverter not shown on llbl designer

Posts   
 
    
ivargas
User
Posts: 9
Joined: 07-Dec-2010
# Posted on: 19-Jan-2011 22:39:41   

I've been crazy looking for a existing post for a solution... found a few, none helpful to my problem.

I made a new vs project to handle my converters and enums. I created the ".typeImports" file to declare "type shorcuts" with my enums - all perfect. So, I'm pretty sure the designer is loading the dll.

The same dll is containing a custom type converter. I tried two approachs with no success:

  1. inherit from System.ComponenModel.TypeConverter
  2. implementing NHibernate.UserTypes.IUsertype && inherit from System.ComponenModel.TypeConverter

The type converter is not shown either on the element's field mapping nor on project's type conversion definitions. Not even thinking on generate mappings or using it on my app.

By simplifying to the absurd step by step I finish wit:


    public class MyConverter : TypeConverter
    {
        public new bool CanConvertFrom(Type sourceType) { return true; }

        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return true; }

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            return "Enum";
        }

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            return "String";
        }

        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            return string.Empty;
        }
    }

I also tried compiling explicitly for x86 and x64... nones. I put the dll in a empty folder... nothing.

My environment is: OS: Win 7 x64 LLBL: v.3.0 Final Target DB: Oracle Target Framework: NHiberante DB Driver: Oracle ODP.NET

Much appreciated.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 20-Jan-2011 05:35:24   

Did you add the typeconverter definition? There, do you see your TypeConverter available in the combobox?

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 20-Jan-2011 09:31:56   

Have you placed the nhibernate.dll in the folder of the typeconverter dll? It has to be there as the typeconverter dll otherwise won't load because it's missing a referenced dll (as IUserType is a type in the nhibernate.dll). This is an unfortunate step / situation, but also one which can't be avoided. You don't need a typeconverter for enums btw, they're automatic.

The other thing you have to realize is that if you use .net 4, and you compile your dll to .net 4, you have to run the designer using the .net 4 runner (included in the installation folder), otherwise the designer will run on .net 3.5 and it can't load the typeconverter dll.

Frans Bouma | Lead developer LLBLGen Pro
ivargas
User
Posts: 9
Joined: 07-Dec-2010
# Posted on: 27-Jan-2011 20:57:55   

Help very appreciated! The trick was to copy all dll's referenced by the converter.

Thanks again.

Otis wrote:

Have you placed the nhibernate.dll in the folder of the typeconverter dll? It has to be there as the typeconverter dll otherwise won't load because it's missing a referenced dll (as IUserType is a type in the nhibernate.dll). This is an unfortunate step / situation, but also one which can't be avoided. You don't need a typeconverter for enums btw, they're automatic.

The other thing you have to realize is that if you use .net 4, and you compile your dll to .net 4, you have to run the designer using the .net 4 runner (included in the installation folder), otherwise the designer will run on .net 3.5 and it can't load the typeconverter dll.