mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Support language type
This commit is contained in:
parent
cc7510dc2e
commit
eb74218fab
@ -30,6 +30,10 @@ namespace SqlSugar
|
||||
/// </summary>
|
||||
public InitKeyType InitKeyType = InitKeyType.Attribute;
|
||||
/// <summary>
|
||||
/// Exception prompt language
|
||||
/// </summary>
|
||||
public SugarLanguageType LanguageType { get=>ErrorMessage.SugarLanguageType; set=>ErrorMessage.SugarLanguageType=value; }
|
||||
/// <summary>
|
||||
///If true, there is only one connection instance in the same thread within the same connection string
|
||||
//[Obsolete("use SqlSugar.Ioc")]
|
||||
///// </summary>
|
||||
|
15
Src/Asp.Net/SqlSugar/Enum/LanguageType.cs
Normal file
15
Src/Asp.Net/SqlSugar/Enum/LanguageType.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public enum SugarLanguageType
|
||||
{
|
||||
Default=0,
|
||||
Chinese=1,
|
||||
English=2
|
||||
}
|
||||
}
|
@ -91,6 +91,7 @@
|
||||
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
|
||||
<Compile Include="Abstract\InsertableProvider\SplitInsertable.cs" />
|
||||
<Compile Include="Entities\SqlSguarTransaction.cs" />
|
||||
<Compile Include="Enum\LanguageType.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubAs.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubHaving.cs" />
|
||||
<Compile Include="Interface\ISugarRepository.cs" />
|
||||
|
@ -6,6 +6,7 @@ namespace SqlSugar
|
||||
{
|
||||
internal static partial class ErrorMessage
|
||||
{
|
||||
internal static SugarLanguageType SugarLanguageType { get; set; } = SugarLanguageType.Default;
|
||||
internal static string ObjNotExist
|
||||
{
|
||||
get
|
||||
@ -43,10 +44,21 @@ namespace SqlSugar
|
||||
|
||||
internal static string GetThrowMessage(string enMessage, string cnMessage, params string[] args)
|
||||
{
|
||||
List<string> formatArgs = new List<string>() { enMessage, cnMessage };
|
||||
formatArgs.AddRange(args);
|
||||
return string.Format(@"中文提示 : {1}
|
||||
if (SugarLanguageType == SugarLanguageType.Default)
|
||||
{
|
||||
List<string> formatArgs = new List<string>() { enMessage, cnMessage };
|
||||
formatArgs.AddRange(args);
|
||||
return string.Format(@"中文提示 : {1}
|
||||
English Message : {0}", formatArgs.ToArray());
|
||||
}
|
||||
else if (SugarLanguageType == SugarLanguageType.English)
|
||||
{
|
||||
return enMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
return cnMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user