.NET 1.1 to .NET 2.0

Posts   
 
    
Posts: 31
Joined: 17-Aug-2005
# Posted on: 31-Oct-2007 13:23:24   

Hi,

I have used my generated code from .NET 1.1 in my .NET 2.0 project. I decided today to convert my LLBLGen project to generate .NET 2.0 code.

I now have lots of errors and need to know if there is a way to disable/enable a hidden feature that I'm not aware of?

Below one of the errors I'm getting: Code: If Not shift.DayOffShift Then

Error:61 Operator 'Not' is not defined for type 'System.Nullable(Of Boolean)'. C:\Documents and Settings\Philip\My Documents\Visual Studio 2005\Projects\BES\BlickTime\GlobalUpdate.aspx.vb 1361 52 BlickTime

Can anyone please help me to fix this, I don't want to go through all my code fixing or casting types?

Regards,

Philip

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 31-Oct-2007 16:07:29   

Nullable Types was introduces in .NET 2.0.

Starting from v.2.0 LLBLGen Pro is defaulted to generate nullable types for fields which allows null in the database. This could break old code, that's why this breaking change was documneted in the manual.

LLBLGen Pro manual v.2.x -> Migrating your code -> Breaking changes:

.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. A plug-in is included in the designer which allows you to set all the generate as nullable type flags of all the entity fields selected to a given value (true/false) so you can migrate your code from 1.0.2005.1 to v2.0 more easily, as having a lot of nullable types can break a lot of code.

Posts: 31
Joined: 17-Aug-2005
# Posted on: 01-Nov-2007 07:54:57   

Hi,

Thank you for the quick response. I'll try the solution.

Regards,

Philip

Styx
User
Posts: 1
Joined: 12-Dec-2007
# Posted on: 12-Dec-2007 09:58:41   

Hi,

I hope my post is some how related to this thread. I need to save a null value in the database. I use LLBL Gen Pro 2.5 final. The problem is that i use .net framework 1.1 and nullable types are not supported. Is there any way to solve this problem without upgarding to framework 2.0 or more? Thank you.

Kind regards, Styx

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Dec-2007 10:20:41   

I hope my post is some how related to this thread.

Actually it's not simple_smile

I need to save a null value in the database. I use LLBL Gen Pro 2.5 final. The problem is that i use .net framework 1.1 and nullable types are not supported. Is there any way to solve this problem without upgarding to framework 2.0 or more?

Please check Entities, NULL values and defaults in the LLBLGen Pro manual under the following path: Using the generated code -> Adapter/SelfServicing -> Using the entity classes

Note: Next time please create a new thread instead of using older threads. ref: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725