Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #149 from stoveproject/dev
Browse files Browse the repository at this point in the history
dev to master
  • Loading branch information
osoykan authored May 31, 2018
2 parents 5ed7c89 + bf616e1 commit 351ce96
Show file tree
Hide file tree
Showing 40 changed files with 641 additions and 361 deletions.
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.3.6</VersionPrefix>
<VersionPrefix>2.4.0</VersionPrefix>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PackageIconUrl>https://raw.githubusercontent.com/osoykan/Stove/master/stove.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/osoykan/Stove</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/Stove.Dapper/Stove.Dapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="DapperExtensions.DotnetCore" Version="1.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace Stove.EntityFrameworkCore.Repositories
/// <typeparam name="TPrimaryKey">Primary key of the entity</typeparam>
public class EfCoreRepositoryBase<TDbContext, TEntity, TPrimaryKey> :
StoveRepositoryBase<TEntity, TPrimaryKey>,
ISupportsExplicitLoading<TEntity, TPrimaryKey>,
IRepositoryWithDbContext
where TEntity : class, IEntity<TPrimaryKey>
where TDbContext : DbContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ public class StoveEntityMaterializerSource : EntityMaterializerSource
private static readonly MethodInfo NormalizeDateTimeMethod = typeof(StoveEntityMaterializerSource).GetTypeInfo().GetMethod(nameof(NormalizeDateTime), BindingFlags.Static | BindingFlags.NonPublic);
private static readonly MethodInfo NormalizeNullableDateTimeMethod = typeof(StoveEntityMaterializerSource).GetTypeInfo().GetMethod(nameof(NormalizeNullableDateTime), BindingFlags.Static | BindingFlags.NonPublic);

public override Expression CreateReadValueExpression(Expression valueBuffer, Type type, int index, IProperty property = null)
public override Expression CreateReadValueExpression(Expression valueBuffer, Type type, int index, IPropertyBase propertyBase)
{
if (type == typeof(DateTime))
{
return Expression.Call(
NormalizeDateTimeMethod,
base.CreateReadValueExpression(valueBuffer, type, index, property)
base.CreateReadValueExpression(valueBuffer, type, index, propertyBase)
);
}

if (type == typeof(DateTime?))
{
return Expression.Call(
NormalizeNullableDateTimeMethod,
base.CreateReadValueExpression(valueBuffer, type, index, property)
base.CreateReadValueExpression(valueBuffer, type, index, propertyBase)
);
}

return base.CreateReadValueExpression(valueBuffer, type, index, property);
return base.CreateReadValueExpression(valueBuffer, type, index, propertyBase);
}

private static DateTime NormalizeDateTime(DateTime value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,5 @@ protected virtual void Release(DbContext dbContext)
{
dbContext.Dispose();
}

//private static void ObjectContext_ObjectMaterialized(DbContext dbContext, ObjectMaterializedEventArgs e)
//{
// dbContext.Configuration.AutoDetectChangesEnabled = true;

// dbContext.Entry(e.Entity).State = previousState;

// DateTimePropertyInfoHelper.NormalizeDatePropertyKinds(e.Entity, entityType);
// var previousState = dbContext.Entry(e.Entity).State;

// dbContext.Configuration.AutoDetectChangesEnabled = false;
// var entityType = ObjectContext.GetObjectType(e.Entity.GetType());
//}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.1.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Stove.NHibernate/Stove.NHibernate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="FluentNHibernate" Version="2.1.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="NHibernate" Version="5.1.2" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Stove.NLog/Stove.NLog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NLog" Version="4.5.5" />
<PackageReference Include="NLog" Version="4.5.6" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Stove.WebApi/Stove.WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.0.3" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
26 changes: 0 additions & 26 deletions src/Stove/Domain/Repositories/ISupportsExplicitLoading.cs

This file was deleted.

80 changes: 0 additions & 80 deletions src/Stove/Domain/Repositories/RepositoryExtensions.cs

This file was deleted.

10 changes: 5 additions & 5 deletions src/Stove/Stove.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
<PackageReference Include="Autofac.Extras.IocManager.DynamicProxy" Version="3.2.1" />
<PackageReference Include="JetBrains.Annotations" Version="11.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.Collections.Immutable" Version="1.4.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.4.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="1.1.0" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="1.0.2" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Stove.Demo.WebApiCore/Stove.Demo.WebApiCore.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0-preview-20180510-03" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Shouldly" Version="3.0.0" />
Expand Down
14 changes: 8 additions & 6 deletions test/Stove.EntityFrameworkCore.Tests/Domain/Blog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Stove.EntityFrameworkCore.Tests.Domain
{
public class Blog : AggregateRoot, IHasCreationTime
public class Blog : AggregateRoot, IHasCreationTime, ISoftDelete
{
public Blog()
{
Expand All @@ -34,20 +34,22 @@ public Blog(string name, string url) : this()
);
}

public string Name { get; set; }
public virtual string Name { get; set; }

public string Url { get; protected set; }
public virtual string Url { get; protected set; }

public ICollection<Post> Posts { get; set; }
public virtual ICollection<Post> Posts { get; set; }

public DateTime CreationTime { get; set; }
public virtual DateTime CreationTime { get; set; }

public bool IsDeleted { get; set; }

private void When(BlogUrlChangedEvent @event)
{
Url = @event.Url;
}

public void ChangeUrl(string url)
public virtual void ChangeUrl(string url)
{
if (string.IsNullOrWhiteSpace(url))
{
Expand Down
6 changes: 3 additions & 3 deletions test/Stove.EntityFrameworkCore.Tests/Domain/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ namespace Stove.EntityFrameworkCore.Tests.Domain
public class Post : AuditedEntity<Guid>
{
[Required]
public Blog Blog { get; set; }
public virtual Blog Blog { get; set; }

public string Title { get; set; }
public virtual string Title { get; set; }

public string Body { get; set; }
public virtual string Body { get; set; }

public Post()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Stove.Events.Bus;

namespace Stove.EntityFrameworkCore.Tests.Domain_Product.Events
{
public class VariantAdded : Event
{
public int ProductId { get; }

public string Barcode { get; set; }

public string VariantName { get; set; }

public VariantAdded(int productId, string barcode, string variantName)
{
ProductId = productId;
Barcode = barcode;
VariantName = variantName;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Stove.Events.Bus;

namespace Stove.EntityFrameworkCore.Tests.Domain_Product.Events
{
public class VariantValueAdded : Event
{
public int Id { get; }

public string Value { get; }

public VariantValueAdded(int id, string value)
{
Id = id;
Value = value;
}
}
}
Loading

0 comments on commit 351ce96

Please sign in to comment.