Little bug

6 posts, 1 answers
  1. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 30 Jul 2012 Link to this post

    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
  2. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 30 Jul 2012 Link to this post

    and this btw causes an error:

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

    'HasLength' is not a member of 'Telerik.OpenAccess.Metadata.Fluent.InternalPropertyConfiguration'.
  3. DevCraft banner
  4. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 30 Jul 2012 Link to this post

    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.
  5. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 30 Jul 2012 Link to this post

    Hello Jan,

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

    :-)

    Erik
  6. Answer
    Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 30 Jul 2012 Link to this post

    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.
  7. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 30 Jul 2012 Link to this post

    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!
Back to Top
DevCraft banner