Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • NDDT 68 posts 239 karma points c-trib
    May 11, 2016 @ 10:29
    NDDT
    0

    Hi,

    I have a PetaPoco-Database in which I want to save complex Search-Querys in Form of a single String.

    Sadly the String seems to long and I don't know how to allow for longer NVarChars. Can someone help?

    [TableName("SavedSearches")]
    [PrimaryKey("Id", autoIncrement = true)]
    public class SavedSearches
    {
        [Column("Id")]
        [PrimaryKeyColumn(AutoIncrement = true)]
        public int Id { get; set; }
    
        [Column("CreatedOn")]
        public DateTime CreatedOn { get; set; }
    
        [Column("UserId")]
        public string UserId { get; set; }
    
        [Column("Query")]
        public string Query { get; set; }
    
        [Column("Name")]
        public string Name { get; set; }
    }
    
  • Tim Geyssens 6419 posts 15036 karma points MVP 2x c-trib
    May 11, 2016 @ 10:59
    Tim Geyssens
    100

    You could add the additional attribute [SpecialDbType(SpecialDbTypes.NTEXT)]

  • NDDT 68 posts 239 karma points c-trib
    May 11, 2016 @ 11:14
    NDDT
    0

    This works for me. Can I somehow controll the maximum length in the Database?

  • Tim Geyssens 6419 posts 15036 karma points MVP 2x c-trib
    May 11, 2016 @ 11:41
    Tim Geyssens
    0

    Not with attributes I think but you could do it manually on the db table column once it's created

  • Kenneth Solberg 222 posts 412 karma points
    Oct 28, 2016 @ 13:21
    Kenneth Solberg
    2

    You can user [Length(256)] to control ... length.

  • Tim Geyssens 6419 posts 15036 karma points MVP 2x c-trib
    Oct 28, 2016 @ 13:22
    Tim Geyssens
    0

    Ow didn't know that, thanks for sharing!

Please Sign in or register to post replies

Write your reply to:

Draft