Skip to content

Commit 3005ed7

Browse files
committed
init
0 parents  commit 3005ed7

File tree

435 files changed

+105585
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

435 files changed

+105585
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.sln.docstates
8+
.vs/
9+
.idea/
10+
#Auto Generate files
11+
__ConfigTemp/
12+
13+
# Build results
14+
15+
[Dd]ebug/
16+
[Rr]elease/
17+
x64/
18+
build/
19+
[Bb]in/
20+
[Oo]bj/
21+
22+
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
23+
!packages/*/build/
24+
25+
# MSTest test Results
26+
[Tt]est[Rr]esult*/
27+
[Bb]uild[Ll]og.*
28+
29+
*_i.c
30+
*_p.c
31+
*.ilk
32+
*.meta
33+
*.obj
34+
*.pch
35+
*.pdb
36+
*.pgc
37+
*.pgd
38+
*.rsp
39+
*.sbr
40+
*.tlb
41+
*.tli
42+
*.tlh
43+
*.tmp
44+
*.tmp_proj
45+
*.log
46+
*.vspscc
47+
*.vssscc
48+
.builds
49+
*.pidb
50+
*.log
51+
*.scc
52+
*.config
53+
54+
# Visual C++ cache files
55+
ipch/
56+
*.aps
57+
*.ncb
58+
*.opensdf
59+
*.sdf
60+
*.cachefile
61+
62+
# Visual Studio profiler
63+
*.psess
64+
*.vsp
65+
*.vspx
66+
67+
# Guidance Automation Toolkit
68+
*.gpState
69+
70+
# ReSharper is a .NET coding add-in
71+
_ReSharper*/
72+
*.[Rr]e[Ss]harper
73+
74+
# TeamCity is a build add-in
75+
_TeamCity*
76+
77+
# DotCover is a Code Coverage Tool
78+
*.dotCover
79+
80+
# NCrunch
81+
*.ncrunch*
82+
.*crunch*.local.xml
83+
84+
# Installshield output folder
85+
[Ee]xpress/
86+
87+
# DocProject is a documentation generator add-in
88+
DocProject/buildhelp/
89+
DocProject/Help/*.HxT
90+
DocProject/Help/*.HxC
91+
DocProject/Help/*.hhc
92+
DocProject/Help/*.hhk
93+
DocProject/Help/*.hhp
94+
DocProject/Help/Html2
95+
DocProject/Help/html
96+
97+
# Click-Once directory
98+
publish/
99+
100+
# Publish Web Output
101+
*.Publish.xml
102+
103+
# NuGet Packages Directory
104+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
105+
#packages/
106+
107+
# Windows Azure Build Output
108+
csx
109+
*.build.csdef
110+
111+
# Windows Store app package directory
112+
AppPackages/
113+
114+
# Others
115+
sql/
116+
*.Cache
117+
ClientBin/
118+
[Ss]tyle[Cc]op.*
119+
~$*
120+
*~
121+
*.dbmdl
122+
*.[Pp]ublish.xml
123+
*.pfx
124+
*.publishsettings
125+
126+
# RIA/Silverlight projects
127+
Generated_Code/
128+
129+
# Backup & report files from converting an old project file to a newer
130+
# Visual Studio version. Backup files are not needed, because we have git ;-)
131+
_UpgradeReport_Files/
132+
Backup*/
133+
UpgradeLog*.XML
134+
UpgradeLog*.htm
135+
136+
# SQL Server files
137+
App_Data/*.mdf
138+
App_Data/*.ldf
139+
140+
141+
#LightSwitch generated files
142+
GeneratedArtifacts/
143+
_Pvt_Extensions/
144+
ModelManifest.xml
145+
146+
# =========================
147+
# Windows detritus
148+
# =========================
149+
150+
# Windows image file caches
151+
Thumbs.db
152+
ehthumbs.db
153+
154+
# Folder config file
155+
Desktop.ini
156+
157+
# Recycle Bin used on file shares
158+
$RECYCLE.BIN/
159+
160+
# Mac desktop service store files
161+
.DS_Store
162+
/CloudBagOffline/packages
163+
/CloudBagOffline/CloudBag.HermesControl
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System;
2+
using System.Configuration;
3+
using Microsoft.Extensions.Configuration;
4+
5+
namespace Configuration
6+
{
7+
public static class ConfigHelper
8+
{
9+
private static readonly IConfigurationRoot Configuration;
10+
static ConfigHelper()
11+
{
12+
Configuration = new ConfigurationBuilder()
13+
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
14+
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
15+
.Build();
16+
17+
}
18+
public static T GetConfig<T>(string key, T defaultValue)
19+
{
20+
try
21+
{
22+
var result = Configuration[key];
23+
return (T)Convert.ChangeType(result, typeof(T));
24+
}
25+
catch (Exception)
26+
{
27+
if (defaultValue != null)
28+
{
29+
return defaultValue;
30+
}
31+
return default(T);
32+
}
33+
}
34+
35+
public static T GetConfig<T>(string key)
36+
{
37+
try
38+
{
39+
var result = Configuration[key];
40+
return (T)Convert.ChangeType(result, typeof(T));
41+
}
42+
catch (Exception)
43+
{
44+
throw new Exception(string.Format("没有在配置文件中的appSettings中找到{0}的配置,请检查配置文件配置!", key));
45+
}
46+
}
47+
}
48+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
8+
<NoWarn>1701;1702;1591</NoWarn>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
5+
namespace Configuration
6+
{
7+
public class GlobalSetting
8+
{
9+
10+
public static string CurrentRootPath;
11+
12+
/// <summary>
13+
/// JWT 私有秘钥
14+
/// </summary>
15+
public const string JWTSecretKey = "GQDstcKxs0NHjPOuXOYg5MbeJ1XT0uFiwDV8VBr8";
16+
17+
/// <summary>
18+
/// 当前登陆用户的Eid
19+
/// </summary>
20+
public static string CurrentLoginUserGuid = "cbeid";
21+
/// <summary>
22+
/// 带有权限的MenuTid
23+
/// </summary>
24+
public static string CurrentMenu = "cbmenu";
25+
26+
27+
#region 上帝模式
28+
29+
public static List<string> GoldList
30+
{
31+
get
32+
{
33+
var result = new List<string>();
34+
var list = ConfigHelper.GetConfig("GoldList", string.Empty)
35+
.Split(new string[] { "],[" }, StringSplitOptions.None).ToList();
36+
foreach (var li in list)
37+
{
38+
result.Add(li.Replace("]", "").Replace("[", ""));
39+
}
40+
return result;
41+
}
42+
}
43+
#endregion
44+
}
45+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using AntData.ORM.Data;
2+
using System;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using Infrastructure.Web;
6+
7+
namespace DbModel
8+
{
9+
public class DbContext
10+
{
11+
public static MysqlDbContext<AntEntity> DB
12+
{
13+
get
14+
{
15+
var db = new MysqlDbContext<AntEntity>("ant_mysql");
16+
db.IsEnableLogTrace = true;
17+
db.OnLogTrace = OnCustomerTraceConnection;
18+
return db;
19+
}
20+
}
21+
22+
/// <summary>
23+
/// 记录sql
24+
/// </summary>
25+
/// <param name="customerTraceInfo"></param>
26+
public static void OnCustomerTraceConnection(CustomerTraceInfo customerTraceInfo)
27+
{
28+
string sql = customerTraceInfo.SqlText;
29+
try
30+
{
31+
sql = customerTraceInfo.CustomerParams.Aggregate(customerTraceInfo.SqlText,
32+
(current, item) => current.Replace(item.Key, item.Value.Value.ToString()));
33+
}
34+
catch (Exception)
35+
{
36+
//ignore
37+
}
38+
sql += Environment.NewLine;
39+
foreach (var detail in customerTraceInfo.RunTimeList)
40+
{
41+
sql += $"Server:{detail.Server},DB名称:{detail.DbName}, 执行时间:{detail.Duration.TotalSeconds}秒" +Environment.NewLine ;
42+
Debug.Write(sql);
43+
}
44+
RequestContext.Instance.Set("lastSql",sql.Replace("\r\n\t"," ").Replace("\r\n"," "));
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)