IsOptional at runtime

Posts   
 
    
DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 07-Apr-2011 21:02:53   

For 3.1 SelfServicing

Here's a scenario.

I have a view mapped as an entity. The view has a column which uses ISNULL and I've set the Optional flag to true in the designer. The designer shows a warning about this, which is fine.

Is there a way to check the Optional flag at runtime? Like IEntityField.IsOptional?

If not, could that be added?

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Apr-2011 06:13:35   

You can field the IsNullable flag on the field. For instance_ CustomerFields.City.IsNullable_

David Elizondo | LLBLGen Support Team
DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 08-Apr-2011 06:45:47   

daelmo wrote:

You can field the IsNullable flag on the field. For instance_ CustomerFields.City.IsNullable_

That's actually the issue. In this case, IsNullable returns False because the view uses an ISNULL function for the field, but IsOptional (if it was there) would return true.

I'm using an updatable view and the ISNULL function creates a default value for a particular field.

It would be fantastic to have all the mapping information that is in the project file available in the runtimes. At the moment, there's lots of information that requires including the project file within an application then querying the xml.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Apr-2011 06:48:44   

I see. Yes, you can obtain that info. Are you using Adapter or SelfServicing?

David Elizondo | LLBLGen Support Team
DarkRoast
User
Posts: 42
Joined: 14-Jul-2010
# Posted on: 08-Apr-2011 17:59:37   

SelfServicing.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Apr-2011 21:58:07   

I found that SourceColumnIsNullable indicate the persistence info status for the nullability. That is: the mapping information from the DB. And IsNullable flag depends upon the value you set for IsOptional in the designer.

David Elizondo | LLBLGen Support Team