v2 issues...

Posts   
 
    
Posts: 35
Joined: 22-May-2006
# Posted on: 14-Sep-2006 00:31:27   

Hi,

I recently upgraded to the v2 version of LLBLGen.

Here is an existing function that works perfectly fine with the v1:


bAlienNoExists = pcmObj.PCDMemberAlienNumberExists(precasemember.PcmAlienNumber);

The function expects an integer. When I try the code using v2, i recieve the following error:

Argument '1': cannot convert from 'int?' to 'int'

Do I need to change my code to make this work? When I generated the LLBLGen project I selected the compatability to the previous.

I also get this with all other datatypes such as Cannot implicity convert type 'System.Guid?' to 'System.Guid'. An explicit conversion exists. (Are you missing a cast?)

Thanks,

Nate

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 14-Sep-2006 02:03:53   

The manual has a section at the beginning titled Migrating Your Code. The second bullet under Breaking Changes covers this issue. Please read through this section as it will explain what changes to expect. This is from the manual.

.NET 2.0: if an entity field is nullable, by default it is generated as a Nullable(of T) field. This means that if you read that field's property, you have to read the value into a Nullable(of T) typed variable as well. You can control this through the preferences and project properties by using the preference/project property GenerateNullableFieldsAsNullableTypes. This setting controls every new field's Generate as Nullable type setting. By default all the fields in your project will have that setting set to true, if they're nullable and a value type. To disable nullable fields for some fields, you can disable that for those fields in the entity editor. It's recommended to have all fields which are nullable as Nullable(Of T), and only disable this feature if your current code misuses the default value feature of the entity fields. Please see below as well how to detect that.

Posts: 35
Joined: 22-May-2006
# Posted on: 15-Sep-2006 23:07:03   

thanks, that helped out a lot.