More in this section
Forums / Ecommerce / How to change data type of [title_] of table [sf_meta_fields] from varchar to nvarchar

How to change data type of [title_] of table [sf_meta_fields] from varchar to nvarchar

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Thanh
    Thanh avatar
    13 posts
    21 Nov 2011
    18 Feb 2014
    Link to this post

    Hi guys.

    I'm using Sitefinity for Vietnamese so I need to use Unicode in name of custom filed but Sitefinity cannot store it in database, can anyone help me?

    Thanks so much.

  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    21 Jan 2015
    19 Feb 2014
    Link to this post
    Hello Thanh,

    The column data type defined by default in the database can`t be changed and even if you do it will always revert back to the original data type. We only support one way synchronization with the database schema, custom changes of fields directly into the database are not preserved and Sitefintiy always tries to migrate the db schema to be up to date with the mappings defined in our code. When you rebuild your project - sitefinity performs an upgrade - because your new build number differs from the last schema version records kept in the databse.
    During the upgrade we make sure the db schema (including column sizes) is up to date with the coded mappings of each persistent class.

    What you need to do is use the MetadataMapping attribute if you want to specify whether type of given db column is VARCHAR or NVARCHAR. In your case you will need to pass two parameters to the MetadataMapping constructor -> bool isUnicode(e.g. whether is NVARCHAR) and bool isLong(e.g. whether  is MAX).
    Copy Code
            [MetadataMapping(true, true)]
            public virtual Lstring WhatIsInTheBox
                    if (this.whatIsInTheBox == null)
                        this.whatIsInTheBox = this.GetString("WhatIsInTheBox");
                    return this.whatIsInTheBox;
                    this.whatIsInTheBox = value;
                    this.SetString("WhatIsInTheBox", this.whatIsInTheBox);

    Vassil Vassilev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered