Commit bb573a87 authored by 阿星Plus's avatar 阿星Plus

v1.0.2

parent 9e2b6425
...@@ -14,13 +14,19 @@ ...@@ -14,13 +14,19 @@
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/Meowv/.netcoreplus</PackageProjectUrl> <PackageProjectUrl>https://github.com/Meowv/.netcoreplus</PackageProjectUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/13010050</PackageIconUrl> <PackageIconUrl>https://avatars2.githubusercontent.com/u/13010050</PackageIconUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/Meowv/.netcoreplus/master/LICENSE</PackageLicenseUrl> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>plus;plus.entityframework;.netcoreplus;</PackageTags> <PackageTags>plus;plus.entityframework;.netcoreplus;</PackageTags>
<PackageReleaseNotes>Plus.EntityFramework</PackageReleaseNotes> <PackageReleaseNotes>Plus.EntityFramework</PackageReleaseNotes>
<Version>1.0.0.3</Version> <Version>1.0.2</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>Plus.EntityFramework.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>Plus.EntityFramework.xml</DocumentationFile> <DocumentationFile>Plus.EntityFramework.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
......
...@@ -244,8 +244,7 @@ namespace Plus.EntityFramework ...@@ -244,8 +244,7 @@ namespace Plus.EntityFramework
protected virtual void AddDomainEvents(List<DomainEventEntry> domainEvents, object entityAsObj) protected virtual void AddDomainEvents(List<DomainEventEntry> domainEvents, object entityAsObj)
{ {
var generatesDomainEventsEntity = entityAsObj as IGeneratesDomainEvents; if (!(entityAsObj is IGeneratesDomainEvents generatesDomainEventsEntity))
if (generatesDomainEventsEntity == null)
{ {
return; return;
} }
...@@ -266,8 +265,7 @@ namespace Plus.EntityFramework ...@@ -266,8 +265,7 @@ namespace Plus.EntityFramework
protected virtual void CheckAndSetId(EntityEntry entry) protected virtual void CheckAndSetId(EntityEntry entry)
{ {
var entity = entry.Entity as IEntity<Guid>; if (entry.Entity is IEntity<Guid> entity && entity.Id == Guid.Empty)
if (entity != null && entity.Id == Guid.Empty)
{ {
var idPropertyEntry = entry.Property("Id"); var idPropertyEntry = entry.Property("Id");
......
...@@ -14,8 +14,7 @@ namespace Plus.EntityFramework.Repositories ...@@ -14,8 +14,7 @@ namespace Plus.EntityFramework.Repositories
public static DbContext GetDbContext<TEntity, TPrimaryKey>(this IRepository<TEntity, TPrimaryKey> repository) public static DbContext GetDbContext<TEntity, TPrimaryKey>(this IRepository<TEntity, TPrimaryKey> repository)
where TEntity : class, IEntity<TPrimaryKey> where TEntity : class, IEntity<TPrimaryKey>
{ {
var repositoryWithDbContext = ProxyHelper.UnProxy(repository) as IRepositoryWithDbContext; if (ProxyHelper.UnProxy(repository) is IRepositoryWithDbContext repositoryWithDbContext)
if (repositoryWithDbContext != null)
{ {
return repositoryWithDbContext.GetDbContext(); return repositoryWithDbContext.GetDbContext();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment