You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
3 years ago
|
using JetBrains.Annotations;
|
||
|
using System;
|
||
|
using Volo.Abp;
|
||
|
using Volo.Abp.Domain.Entities;
|
||
|
|
||
|
namespace Sanhe.Abp.LocalizationManagement;
|
||
|
|
||
|
public class Text : Entity<int>
|
||
|
{
|
||
|
public virtual string CultureName { get; protected set; }
|
||
|
public virtual string Key { get; protected set; }
|
||
|
public virtual string Value { get; protected set; }
|
||
|
public virtual string ResourceName { get; protected set; }
|
||
|
protected Text() { }
|
||
|
public Text(
|
||
|
[NotNull] string resourceName,
|
||
|
[NotNull] string cultureName,
|
||
|
[NotNull] string key,
|
||
|
[CanBeNull] string value)
|
||
|
{
|
||
|
ResourceName = Check.NotNull(resourceName, nameof(resourceName), ResourceConsts.MaxNameLength);
|
||
|
CultureName = Check.NotNullOrWhiteSpace(cultureName, nameof(cultureName), LanguageConsts.MaxCultureNameLength);
|
||
|
Key = Check.NotNullOrWhiteSpace(key, nameof(key), TextConsts.MaxKeyLength);
|
||
|
|
||
|
Value = !value.IsNullOrWhiteSpace()
|
||
|
? Check.NotNullOrWhiteSpace(value, nameof(value), TextConsts.MaxValueLength)
|
||
|
: "";
|
||
|
}
|
||
|
|
||
|
public void SetValue(string value)
|
||
|
{
|
||
|
Value = !value.IsNullOrWhiteSpace()
|
||
|
? Check.NotNullOrWhiteSpace(value, nameof(value), TextConsts.MaxValueLength)
|
||
|
: Value;
|
||
|
}
|
||
|
}
|