This is a migrated thread and some comments may be shown as answers.

Nullable int Property

2 Answers 70 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dmitry
Top achievements
Rank 1
Dmitry asked on 24 Jul 2013, 09:14 PM
Hi.
I use artifical API for mapping nullable field.
prop = tableMappingConfig.HasArtificialPrimitiveProperty("Age", typeof(int));
prop.IsNullable();
But Member with name "Age" in PersistentType did not generated Nullable Property.
And when I'm trying to update field which contain "null"  value
SELECT [id], net  FROM [dbo].[Kassa] WHERE id = 52
result:
id          net
----------- -----------
52          NULL

I'm getting exception
Row not found: GenericOID@8ab3a1bd Kassa id=52\nUPDATE [Kassa] SET [net]=? WHERE [id] = ? AND [net]=?\n(set event logging to all to see parameter values).
In sql profiller we see
declare @p1 int
set @p1=2
exec sp_prepexec @p1 output,N'@p0 int,@p1 int,@p2 int',N'UPDATE [Kassa] SET [net]=@p0 WHERE [id] = @p1 AND [net]=@p2',@p0=1,@p1=52,@p2=0
select @p1

Why when using artifical Api property of CLR Type doesn't generated with nullable?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Dmitry
Top achievements
Rank 1
answered on 25 Jul 2013, 11:51 AM
Problem was resolved.

It was necessary to do so
prop = tableMappingConfig.HasArtificialPrimitiveProperty("Age", typeof(int?))
0
Jan Blessenohl
Telerik team
answered on 25 Jul 2013, 02:19 PM
Hello Dimitry,
The IsNullable() defines the column type. The property in the artificial type is defined by the type itself.

prop = tableMappingConfig.HasArtificialPrimitiveProperty("Age", typeof(int?));
prop.IsNullable();


Regards,
Jan Blessenohl
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvementsshipped with this release.

Tags
Data Access Free Edition
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Dmitry
Top achievements
Rank 1
Jan Blessenohl
Telerik team
Share this question
or