Nullable - Not CLS Compliant

Posts   
 
    
nabils
User
Posts: 46
Joined: 30-Nov-2008
# Posted on: 13-Jan-2009 17:11:22   

LLBLGen Pro version: 2.6 Final Runtime library: 2.6.8.1114 SQL Server version: 9.00.3042.00 (SqlServerDQECompatibilityLevel=2)

Since adding a typeconverter which converts numeric to enum to llblgen which seems to be working fine, my entities are all getting warnings on compilation due to the Nullable in the below code:

public virtual Nullable<Foo> FooId

It says rewrite as Foo? instead of Nullable<Foo>.

Is there any way to get the generated code to emit this?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 13-Jan-2009 20:32:21   

These types are equivalent, so it shouldn't mean a difference. (and for example, VB.NET does support Nullable(Of T) but not T? (which was added in vb.net 2008 ). What did you do to make these errors show up? (as we dont see them pop up in hte build test environment.)

Frans Bouma | Lead developer LLBLGen Pro
nabils
User
Posts: 46
Joined: 30-Nov-2008
# Posted on: 13-Jan-2009 21:20:00   

All I did was added a new typeconverter to the project that converts numeric to enum. Then I went in to the designer and set a specific field on each entity to use this typeonverter. This therefore set the type for that field to Nullable<Foo> (where foo is the enum the typeconverter converts to). I generated the code again and compiled and now get a whole load of cls-compliant warnings.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 14-Jan-2009 10:47:13   

Could you add the ClsCompliant attribute to the typeconverter dll and the dll which contains the enum type definition, then recompile and check that you reference the new build of your dlls ?

cls compliance is annoying but not something which could hurt your code. For example, the DB2 ADO.NET provider isn't cls compliant nor is the ASA ado.net provider, we sometimes get these errors as well during build tests.

Frans Bouma | Lead developer LLBLGen Pro
nabils
User
Posts: 46
Joined: 30-Nov-2008
# Posted on: 14-Jan-2009 11:31:31   

Thanks that worked fine