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

Little bug

5 Answers 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 2
Erik asked on 30 Jul 2012, 01:22 PM
Hello,

I found a little bug when using a DiscriminatorColumn definition:

With aobj_Configuration
   .HasProperty(Function(f) f....
   .HasDiscriminator().ToColumn("SysDiscriminatorColumn").HasColumnType("nvarchar(4000)")
End With

This will generate a SQL Scrip error when using schemaHandler.CreateDDLScript, because it paces your default 255 length always: 

Telerik.OpenAccess.OpenAccessException: SQL exception on 'CREATE TABLE [*****] ( [***_Id] bigint IDENTITY NOT NULL,  [SysDiscriminatorColumn] nvarchar(4000)(255) NULL,  ...

Regards,

Erik

5 Answers, 1 is accepted

Sort by
0
Erik
Top achievements
Rank 2
answered on 30 Jul 2012, 01:29 PM
and this btw causes an error:

.HasDiscriminator().ToColumn("SysDiscriminatorColumn").HasColumnType("nvarchar").HasLength(4000)

'HasLength' is not a member of 'Telerik.OpenAccess.Metadata.Fluent.InternalPropertyConfiguration'.
0
Jan Blessenohl
Telerik team
answered on 30 Jul 2012, 01:37 PM
Hi Erik,
It is not allowed to set the sql type including the length. We have problems with schema migration if you do so. Please use .HasColumnType("nvarchar").HasLength(4000) instead.

Regards,
Jan Blessenohl
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0
Erik
Top achievements
Rank 2
answered on 30 Jul 2012, 02:17 PM
Hello Jan,

Yes, I saw your answer coming, that's why I created my second post: HasLength is not available here!

:-)

Erik
0
Accepted
Jan Blessenohl
Telerik team
answered on 30 Jul 2012, 03:15 PM
Hello Erik,
The discriminator column is of type int or string. If it is of type string, we derive the column length form the longest entry. If you think the discriminator should have a length of 4000 and you really use those entries, this will slow down your application a lot. If the discriminator is a string, you should try to keep it as short as possible. Even using Unicode is not really necessary. What do you want to achieve?

Greetings,
Jan Blessenohl
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0
Erik
Top achievements
Rank 2
answered on 30 Jul 2012, 03:48 PM
Hi Jan,

Thanks for the fast response!

I'm having some double table names in 2 different schema's and guessed that this would create a duplicate hash, but I was wrong. And because of your feedback I now use int!

Thanks Jan!
Tags
General Discussions
Asked by
Erik
Top achievements
Rank 2
Answers by
Erik
Top achievements
Rank 2
Jan Blessenohl
Telerik team
Share this question
or