urgent:: why is the generated dataType not nullable when the "IsNullable" field is checked

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 03-Mar-2008 13:47:01   

asp.net 2.0 llblgenpro 2.5 adapterTemplate

Hiya,

when I look at my entity via the 2.5 designer, the IsNullable field is checked and greyed out.. YET, when I re-genrate the project, I get the error:

<<cannot convert from 'int?' to 'int'>>

In intellisense, I see the variable is listed as "int", NOT "int?"

Why is this? How can I solve this asap?

I also see a checkbox, (net 2.0 +) generate as nullable type... Is the above only for higher versions than .NET 2?

Please reply asap.

Many thanks,

yogi

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 03-Mar-2008 16:54:47   

Hi yogi, try creating a new lgp and regenerate, this never happen to me so it must be something related with the generation or code replacement.

The (net 2.0 +) generate as nullable type must be checked.

Let us know if the problem persist.

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 03-Mar-2008 18:18:44   

Buenas,

I checked the (net 2.0 +) generate as nullable type and re-generated, but it made no difference.

What's the quickest way to generate the new project? To be honest, I'd rather not generate another project as I'm under quite a bit of time pressure, but if I have to, I will.

Can you confirm?

Many thanks,

yogi

arschr
User
Posts: 893
Joined: 14-Dec-2003
# Posted on: 03-Mar-2008 19:26:55   

Did you look at your projects convertNullReferenceTypesToDefaultValue and GenerateNullableFieldsAsNullableTypes settings?

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 03-Mar-2008 19:36:03   

hiya,

Ta for the reply. They're both set to true.

Is this what they should be?

This is all new to me :-0

yogi

arschr
User
Posts: 893
Joined: 14-Dec-2003
# Posted on: 03-Mar-2008 22:37:13   

Is this what they should be?

Seems ok to me.

Is the source file you are looking at being regenerated when you generate the project?

Is the conversion issue in Llblgen generated code?

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 04-Mar-2008 01:22:44   

hiya,

I've noticed in the template bindings that it's using "backwards compaiibility2.0"

Should i be using "sharedTemplates.net2.0"??

many thanks,

yogi

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Mar-2008 02:19:40   

yogiberr wrote:

when I look at my entity via the 2.5 designer, the IsNullable field is checked and greyed out.. YET, when I re-genrate the project, I get the error:

<<cannot convert from 'int?' to 'int'>>

In intellisense, I see the variable is listed as "int", NOT "int?"

Hi yogi, this is copied from the help:

.NET 2.0: support for Nullable(Of valueType) types In .NET 2.0, Microsoft introduced the concept of Nullable valuetypes, which means that a field of type int/Integer or any other ValueType can be null / Nothing. By default, LLBLGen Pro generates all ValueTyped fields as Nullable(Of valueType) if the target platform is .NET 2.0 or CF.NET 2.0. You can overrule this setting on a per-field basis by setting the preference (and project property) GenerateNullableFieldsAsNullableTypes to true or false, which controls the value of the setting for each field if the field has to be generated as nullable or not. (See: Designer - Adding and editing entities). With Nullable types for valuetyped fields, LLBLGen Pro won't convert a null / Nothing value for a field to a default value, but will return null / Nothing from the field's property.

So, two questions: 1. Is ckecked the (net 2.0 +) generate as nullable type checkbox for that field? 2. Please post the exact lines where you are getting this error (compilation error I guess).

Anyway, just to be sure, could you regenerate in an empty folder and compile to see if there are problems?

David Elizondo | LLBLGen Support Team
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 05-Mar-2008 00:33:46   

hiya,

After re-generating for few times it seems to be working now. I'm guessing that that it had something to do with the templates tht i'd chosen..

Anyway,

gracias a todos.

yogi