Skip to content

Commit 08b80a2

Browse files
committed
Merge branch 'dev/develop'
2 parents 1199004 + df8a96a commit 08b80a2

20 files changed

+157
-59
lines changed

build/nuget-build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dotnet pack ../src/OSharp.EntityFrameworkCore.Oracle/OSharp.EntityFrameworkCore.
1313
dotnet pack ../src/OSharp.EntityFrameworkCore.PostgreSql/OSharp.EntityFrameworkCore.PostgreSql.csproj -c Release --output nupkgs
1414
dotnet pack ../src/OSharp.EntityFrameworkCore.Sqlite/OSharp.EntityFrameworkCore.Sqlite.csproj -c Release --output nupkgs
1515
dotnet pack ../src/OSharp.EntityFrameworkCore.SqlServer/OSharp.EntityFrameworkCore.SqlServer.csproj -c Release --output nupkgs
16+
dotnet pack ../src/OSharp.Exceptionless/OSharp.Exceptionless.csproj -c Release --output nupkgs
1617
dotnet pack ../src/OSharp.Hangfire/OSharp.Hangfire.csproj -c Release --output nupkgs
1718
dotnet pack ../src/OSharp.Hosting.Apis/OSharp.Hosting.Apis.csproj -c Release --output nupkgs
1819
dotnet pack ../src/OSharp.Hosting.Core/OSharp.Hosting.Core.csproj -c Release --output nupkgs

build/nuget-delete.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
:: 此命令将删除nuget官网上的osharp指定版本的包
1+
:: 此命令将删除nuget官网上的osharp指定版本的包
22
@echo off
3-
set /p version=请输入要删除的版本号:
3+
set /p version=请输入要删除的版本号:
44
nuget delete OSharpNS.Core %version% -src https://www.nuget.org -NonInteractive
55
nuget delete OSharpNS.AspNetCore %version% -src https://www.nuget.org -NonInteractive
66
nuget delete OSharpNS.Authorization.Datas %version% -src https://www.nuget.org -NonInteractive

build/public.props

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
<Project>
1+
<Project>
22
<PropertyGroup>
33
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
44
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
55
<Authors>LiuliuSoft</Authors>
6-
<Company>柳柳软件(66soft.net)</Company>
7-
<Copyright>Copyright @ 66SOFT 2014-2020</Copyright>
6+
<Company>柳柳软件(liuliusoft)</Company>
7+
<Copyright>Copyright (c) 2014-2020 LIULIUSOFT. All rights reserved.</Copyright>
88
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
9-
<PackageProjectUrl>https://github.com/i66soft/osharp</PackageProjectUrl>
10-
<PackageIconUrl>https://en.gravatar.com/userimage/140788132/0ff3b1e68fa0154337b1528c4276e276.png?size=80</PackageIconUrl>
11-
<RepositoryUrl>https://github.com/i66soft/osharp.git</RepositoryUrl>
9+
<PackageProjectUrl>https://github.com/dotnetcore/osharp</PackageProjectUrl>
10+
<PackageReleaseNotes>https://github.com/dotnetcore/osharp/releases</PackageReleaseNotes>
11+
<PackageIconUrl>https://en.gravatar.com/userimage/140788132/0ff3b1e68fa0154337b1528c4276e276.png?size=128</PackageIconUrl>
12+
<RepositoryUrl>https://github.com/dotnetcore/osharp</RepositoryUrl>
1213
<RepositoryType>git</RepositoryType>
1314
<PackageTags>osharp osharpns</PackageTags>
1415
<NeutralLanguage>zh-CHS</NeutralLanguage>
1516
<SignAssembly>true</SignAssembly>
1617
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)OSharp.Keys.snk</AssemblyOriginatorKeyFile>
18+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
19+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
20+
<IncludeSymbols>true</IncludeSymbols>
21+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1722
</PropertyGroup>
23+
24+
<ItemGroup>
25+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
26+
</ItemGroup>
1827
</Project>

build/version.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<VersionPrefix>7</VersionPrefix>
55
<VersionSuffix>-preview</VersionSuffix>
66
<VersionSuffixVersion>0826</VersionSuffixVersion>
7-
<Version>$(VersionMain).$(VersionPrefix)$(VersionSuffix)$(VersionSuffixVersion)</Version>
8-
<!--<Version>$(VersionMain).$(VersionPrefix)</Version>-->
7+
<!--<Version>$(VersionMain).$(VersionPrefix)$(VersionSuffix)$(VersionSuffixVersion)</Version>-->
8+
<Version>$(VersionMain).$(VersionPrefix)</Version>
99
<AssemblyVersion>$(VersionMain).$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionMain).$(VersionPrefix).$(VersionSuffixVersion)</FileVersion>
1111
</PropertyGroup>

osharp.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSharp.Hosting.Apis", "src\
9292
EndProject
9393
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSharp.EntityFrameworkCore.Oracle", "src\OSharp.EntityFrameworkCore.Oracle\OSharp.EntityFrameworkCore.Oracle.csproj", "{4E26B25A-11F4-445E-AE75-BCE02FA3CA29}"
9494
EndProject
95+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSharp.Exceptionless", "src\OSharp.Exceptionless\OSharp.Exceptionless.csproj", "{DF42EE5B-627F-408D-8E7F-675FACD5A318}"
96+
EndProject
9597
Global
9698
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9799
Debug|Any CPU = Debug|Any CPU
@@ -234,6 +236,10 @@ Global
234236
{4E26B25A-11F4-445E-AE75-BCE02FA3CA29}.Debug|Any CPU.Build.0 = Debug|Any CPU
235237
{4E26B25A-11F4-445E-AE75-BCE02FA3CA29}.Release|Any CPU.ActiveCfg = Release|Any CPU
236238
{4E26B25A-11F4-445E-AE75-BCE02FA3CA29}.Release|Any CPU.Build.0 = Release|Any CPU
239+
{DF42EE5B-627F-408D-8E7F-675FACD5A318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
240+
{DF42EE5B-627F-408D-8E7F-675FACD5A318}.Debug|Any CPU.Build.0 = Debug|Any CPU
241+
{DF42EE5B-627F-408D-8E7F-675FACD5A318}.Release|Any CPU.ActiveCfg = Release|Any CPU
242+
{DF42EE5B-627F-408D-8E7F-675FACD5A318}.Release|Any CPU.Build.0 = Release|Any CPU
237243
EndGlobalSection
238244
GlobalSection(SolutionProperties) = preSolution
239245
HideSolutionNode = FALSE
@@ -275,6 +281,7 @@ Global
275281
{FD428746-CA60-4F80-BC53-BA1A69CF739F} = {611006C4-BCE9-4EDC-8473-A85530C7FADE}
276282
{3C2FF651-1C3F-4A8B-AB77-89E26DA260D0} = {611006C4-BCE9-4EDC-8473-A85530C7FADE}
277283
{4E26B25A-11F4-445E-AE75-BCE02FA3CA29} = {611006C4-BCE9-4EDC-8473-A85530C7FADE}
284+
{DF42EE5B-627F-408D-8E7F-675FACD5A318} = {611006C4-BCE9-4EDC-8473-A85530C7FADE}
278285
EndGlobalSection
279286
GlobalSection(ExtensibilityGlobals) = postSolution
280287
SolutionGuid = {F1A8840B-B7DE-410D-9FA7-BA36515D2E11}

samples/blazor/Liuliu.Demo.BlazorClient/Liuliu.Demo.BlazorClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="BootstrapBlazor" Version="3.1.16" />
10+
<PackageReference Include="BootstrapBlazor" Version="3.1.17" />
1111
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
1212
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
1313
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />

samples/web/Liuliu.Demo.Mvc/Migrations/20200825153425_Init.Designer.cs renamed to samples/web/Liuliu.Demo.Mvc/Migrations/20200826162104_Init.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/web/Liuliu.Demo.Mvc/appsettings.Development.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
},
88
"OSharp": {
99
"DbContexts": {
10-
"SqlServer": {
11-
"DbContextTypeName": "OSharp.Entity.DefaultDbContext,OSharp.EntityFrameworkCore",
12-
//"ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=osharp-mvc-dev02;Trusted_Connection=True;MultipleActiveResultSets=true",
13-
"ConnectionString": "Data Source=osharp-mvc-dev.db",
14-
"DatabaseType": "Sqlite",
15-
"LazyLoadingProxiesEnabled": true,
16-
"AuditEntityEnabled": true,
17-
"AutoMigrationEnabled": true
18-
}
10+
"SqlServer": {
11+
"DbContextTypeName": "OSharp.Entity.DefaultDbContext,OSharp.EntityFrameworkCore",
12+
//"ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=osharp-mvc-dev02;Trusted_Connection=True;MultipleActiveResultSets=true",
13+
"ConnectionString": "Data Source=osharp-mvc-dev.db",
14+
"DatabaseType": "Sqlite",
15+
"LazyLoadingProxiesEnabled": true,
16+
"DateTimeUtcFormatEnabled": true,
17+
"AuditEntityEnabled": true,
18+
"AutoMigrationEnabled": true
19+
}
1920
},
2021
"Jwt": {
2122
"Issuer": "osharp identity",

src/OSharp.EntityFrameworkCore/DbContextBase.cs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// -----------------------------------------------------------------------
1+
// -----------------------------------------------------------------------
22
// <copyright file="DbContextBase.cs" company="OSharp开源团队">
33
// Copyright (c) 2014-2019 OSharp. All rights reserved.
44
// </copyright>
@@ -45,7 +45,7 @@ protected DbContextBase(DbContextOptions options, IServiceProvider serviceProvid
4545
_serviceProvider = serviceProvider;
4646
_entityManager = serviceProvider.GetService<IEntityManager>();
4747
_osharpDbOptions = serviceProvider?.GetOSharpOptions()?.DbContexts?.Values.FirstOrDefault(m => m.DbContextType == GetType());
48-
Logger = serviceProvider?.GetLogger(this);
48+
Logger = serviceProvider.GetLogger(this);
4949
}
5050

5151
/// <summary>
@@ -80,10 +80,10 @@ protected DbContextBase(DbContextOptions options, IServiceProvider serviceProvid
8080
public override int SaveChanges()
8181
{
8282
IList<AuditEntityEntry> auditEntities = new List<AuditEntityEntry>();
83-
if (_osharpDbOptions?.AuditEntityEnabled == true)
83+
if (_osharpDbOptions.AuditEntityEnabled == true)
8484
{
8585
IAuditEntityProvider auditEntityProvider = _serviceProvider.GetService<IAuditEntityProvider>();
86-
auditEntities = auditEntityProvider?.GetAuditEntities(this)?.ToList();
86+
auditEntities = auditEntityProvider?.GetAuditEntities(this).ToList();
8787
}
8888

8989
//开启或使用现有事务
@@ -94,7 +94,7 @@ public override int SaveChanges()
9494
{
9595
AuditEntityEventData eventData = new AuditEntityEventData(auditEntities);
9696
IEventBus eventBus = _serviceProvider.GetService<IEventBus>();
97-
eventBus?.Publish(this, eventData);
97+
eventBus.Publish(this, eventData);
9898
}
9999

100100
return count;
@@ -128,10 +128,10 @@ public override int SaveChanges()
128128
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
129129
{
130130
IList<AuditEntityEntry> auditEntities = new List<AuditEntityEntry>();
131-
if (_osharpDbOptions?.AuditEntityEnabled == true)
131+
if (_osharpDbOptions.AuditEntityEnabled == true)
132132
{
133133
IAuditEntityProvider auditEntityProvider = _serviceProvider.GetService<IAuditEntityProvider>();
134-
auditEntities = auditEntityProvider?.GetAuditEntities(this)?.ToList();
134+
auditEntities = auditEntityProvider?.GetAuditEntities(this).ToList();
135135
}
136136

137137
//开启或使用现有事务
@@ -189,20 +189,26 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
189189
foreach (IEntityRegister register in registers)
190190
{
191191
register.RegisterTo(modelBuilder);
192-
Logger?.LogDebug($"将实体类 {register.EntityType} 注册到上下文 {contextType} 中");
192+
Logger.LogDebug($"将实体类 {register.EntityType} 注册到上下文 {contextType} 中");
193193
}
194-
Logger?.LogInformation($"上下文 {contextType} 注册了{registers.Length}个实体类");
194+
Logger.LogInformation($"上下文 {contextType} 注册了{registers.Length}个实体类");
195195

196-
//按预定前缀更改表名
197-
var entityTypes = modelBuilder.Model.GetEntityTypes().ToList();
196+
List<IMutableEntityType> entityTypes = modelBuilder.Model.GetEntityTypes().ToList();
198197
foreach (IMutableEntityType entityType in entityTypes)
199198
{
199+
//启用时间属性UTC格式
200+
if (_osharpDbOptions.DateTimeUtcFormatEnabled)
201+
{
202+
IEntityDateTimeUtcConversion utcConversion = _serviceProvider.GetService<IEntityDateTimeUtcConversion>();
203+
utcConversion.Convert(entityType);
204+
}
205+
206+
//按预定前缀更改表名
200207
string prefix = GetTableNamePrefix(entityType.ClrType);
201208
if (prefix.IsNullOrEmpty())
202209
{
203210
continue;
204211
}
205-
206212
modelBuilder.Entity(entityType.ClrType).ToTable($"{prefix}_{entityType.GetTableName()}");
207213
}
208214
}

0 commit comments

Comments
 (0)