How to change data type of [title_] of table [sf_meta_fields

Posted by Community Admin on 05-Aug-2018 04:21

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

All Replies

Posted by Community Admin on 18-Feb-2014 00:00

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.

Posted by Community Admin on 19-Feb-2014 00:00

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
[DataMember]
        [MetadataMapping(true, true)]
        public virtual Lstring WhatIsInTheBox
        
            get
            
                if (this.whatIsInTheBox == null)
                
                    this.whatIsInTheBox = this.GetString("WhatIsInTheBox");
                
 
                return this.whatIsInTheBox;
            
 
            set
            
                this.whatIsInTheBox = value;
                this.SetString("WhatIsInTheBox", this.whatIsInTheBox);
            
        


Regards,
Vassil Vassilev
Telerik
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

This thread is closed