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

v1.0.2

parent 9e2b6425
......@@ -14,13 +14,19 @@
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/Meowv/.netcoreplus</PackageProjectUrl>
<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>
<PackageReleaseNotes>Plus.EntityFramework</PackageReleaseNotes>
<Version>1.0.0.3</Version>
<Version>1.0.2</Version>
</PropertyGroup>
<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>
</PropertyGroup>
......
......@@ -244,8 +244,7 @@ namespace Plus.EntityFramework
protected virtual void AddDomainEvents(List<DomainEventEntry> domainEvents, object entityAsObj)
{
var generatesDomainEventsEntity = entityAsObj as IGeneratesDomainEvents;
if (generatesDomainEventsEntity == null)
if (!(entityAsObj is IGeneratesDomainEvents generatesDomainEventsEntity))
{
return;
}
......@@ -266,8 +265,7 @@ namespace Plus.EntityFramework
protected virtual void CheckAndSetId(EntityEntry entry)
{
var entity = entry.Entity as IEntity<Guid>;
if (entity != null && entity.Id == Guid.Empty)
if (entry.Entity is IEntity<Guid> entity && entity.Id == Guid.Empty)
{
var idPropertyEntry = entry.Property("Id");
......
......@@ -14,8 +14,7 @@ namespace Plus.EntityFramework.Repositories
public static DbContext GetDbContext<TEntity, TPrimaryKey>(this IRepository<TEntity, TPrimaryKey> repository)
where TEntity : class, IEntity<TPrimaryKey>
{
var repositoryWithDbContext = ProxyHelper.UnProxy(repository) as IRepositoryWithDbContext;
if (repositoryWithDbContext != null)
if (ProxyHelper.UnProxy(repository) is IRepositoryWithDbContext repositoryWithDbContext)
{
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