コード例 #1
0
        /// <summary>
        /// Add a new resource to the base resource set
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public void AddMissingResource(string name, string value, CultureInfo culture = null)
        {
            DbResourceDataManager manager = new DbResourceDataManager();

            string cultureName = string.Empty;

            if (culture != null)
            {
                cultureName = culture.IetfLanguageTag;
            }

            lock (AddSyncLock)
            {
                // double check if culture neutral version exists
                string item = manager.GetResourceObject(name, BaseName, cultureName) as string;
                if (item != null)
                {
                    return;
                }

                manager.AddResource(name, value, cultureName, BaseName, null);
            }
        }