src/Library/NetPro.Globalization/Localization.SqlLocalizer/SqlLocalizationOptions.cs

(完整代码) 1KB

using System;

namespace Localization.SqlLocalizer
{
    public class SqlLocalizationOptions
    {
        /// <summary>
        /// If UseOnlyPropertyNames is false, this property can be used to define keys with full type names or just the name of the class
        /// </summary>
        public bool UseTypeFullNames { get; set; }

        /// <summary>
        /// This can be used to use only property names to find the keys
        /// </summary>
        public bool UseOnlyPropertyNames { get; set; }

        /// <summary>
        /// Returns only the Key if the value is not found. If set to false, the search key in the database is returned.
        /// </summary>
        public bool ReturnOnlyKeyIfNotFound { get; set; }

        /// <summary>
        /// Creates a new item in the SQL database if the resource is not found
        /// </summary>
        public bool CreateNewRecordWhenLocalisedStringDoesNotExist { get; set; }

        /// <summary>
        /// You can set the required properties to set, get, display the different localization
        /// </summary>
        /// <param name="useTypeFullNames"></param>
        /// <param name="useOnlyPropertyNames"></param>
        /// <param name="returnOnlyKeyIfNotFound"></param>
        /// <param name="createNewRecordWhenLocalisedStringDoesNotExist"></param>
        public void UseSettings(bool useTypeFullNames, bool useOnlyPropertyNames, bool returnOnlyKeyIfNotFound, bool createNewRecordWhenLocalisedStringDoesNotExist)
        {
            UseTypeFullNames = useTypeFullNames;
            UseOnlyPropertyNames = useOnlyPropertyNames;
            ReturnOnlyKeyIfNotFound = returnOnlyKeyIfNotFound;
            CreateNewRecordWhenLocalisedStringDoesNotExist = createNewRecordWhenLocalisedStringDoesNotExist;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。