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 240 karma points c-trib
    May 11, 2016 @ 10:29
    NDDT
    0

    Peta Poco Annotation

    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; }
    }
    
  • Comment author was deleted

    May 11, 2016 @ 10:59

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

  • NDDT 68 posts 240 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?

  • Comment author was deleted

    May 11, 2016 @ 11:41

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

  • Kenneth Solberg 227 posts 418 karma points
    Oct 28, 2016 @ 13:21
    Kenneth Solberg
    3

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

  • Comment author was deleted

    Oct 28, 2016 @ 13:22

    Ow didn't know that, thanks for sharing!

Please Sign in or register to post replies

Write your reply to:

Draft