Skip to content

Commit 661d36d

Browse files
committed
self ref parent child bug fix, package updates
1 parent 85e6f48 commit 661d36d

File tree

12 files changed

+134
-37
lines changed

12 files changed

+134
-37
lines changed

src/NetCoreStack.Proxy/NetCoreStack.Proxy.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.0.1" />
11-
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="2.0.1" />
12-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
13-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.0.2" />
11+
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="2.0.2" />
12+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.1" />
13+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.1" />
1414
<PackageReference Include="NetCoreStack.Contracts" Version="2.0.7" />
1515
<PackageReference Include="NetCoreStack.DispatchProxyAsync" Version="2.0.2" />
1616
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />

src/NetCoreStack.Proxy/Types/ProxyModelMetadata.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,13 @@ private void InitializeTypeInformation()
171171
// self reference loop
172172
continue;
173173
}
174-
174+
175+
if (ModelType == prop.PropertyType)
176+
{
177+
// Parent child ref - self reference loop
178+
continue;
179+
}
180+
175181
metadataList.Add(new ProxyModelMetadata(prop,
176182
ProxyModelMetadataIdentity.ForProperty(prop.PropertyType, prop.Name, ModelType),
177183
reflectedType: _reflectedType));

test/NetCoreStack.Proxy.Mvc.Hosting/NetCoreStack.Proxy.Mvc.Hosting.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
9-
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.1.0" />
8+
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
9+
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.4.0" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

test/NetCoreStack.Proxy.Test.Contracts/ApiResult.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace NetCoreStack.Proxy.Test.Contracts
5+
{
6+
public class Attachment : EntityAuditInsert
7+
{
8+
public string Name { get; set; }
9+
public string Content { get; set; }
10+
}
11+
12+
public class SubtitleAttachmentDto
13+
{
14+
15+
public List<SubtitleAttachment> SubtitleAttachmentList { get; set; }
16+
}
17+
18+
public class SubtitleAttachment : EntityAuditUpdate
19+
{
20+
public long CategoryId { get; set; }
21+
22+
public Category Category { get; set; }
23+
24+
public long SeasonId { get; set; }
25+
26+
public Attachment Attachment { get; set; }
27+
}
28+
29+
public partial class Category : EntityAuditUpdate
30+
{
31+
32+
public string CatName { get; set; }
33+
34+
public long? DomainID { get; set; }
35+
36+
public long? ParentCategoryID { get; set; }
37+
public virtual Category ParentCategory { get; set; }
38+
39+
public DateTime? ReleaseDate { get; set; }
40+
41+
public DateTime? FinalDate { get; set; }
42+
}
43+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using NetCoreStack.Data.Contracts;
2+
using System;
3+
4+
namespace NetCoreStack.Proxy.Test.Contracts
5+
{
6+
public class EntityAuditInsert : EntityInsertActive
7+
{
8+
public long? CreatedByUserUserGroupDomainId { get; set; }
9+
}
10+
11+
public class EntityInsertActive : EntityInsertBase
12+
{
13+
public bool IsActive { get; set; }
14+
15+
public EntityInsertActive()
16+
{
17+
IsActive = true;
18+
}
19+
}
20+
21+
public class EntityAuditUpdate : EntityAuditInsert
22+
{
23+
public long? UpdatedByUserUserGroupDomainId { get; set; }
24+
public DateTime? UpdatedDate { get; set; }
25+
}
26+
27+
public class EntityInsertBase : EntityIdentitySql
28+
{
29+
public DateTime CreatedDate { get; set; }
30+
}
31+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using NetCoreStack.Contracts;
3+
using NetCoreStack.Mvc;
4+
using System.Threading.Tasks;
5+
6+
namespace NetCoreStack.Proxy.Test.Contracts
7+
{
8+
[NetCoreStack.Contracts.ApiRoute("api/[controller]", regionKey: "Main")]
9+
public interface IAttachmentApi : IApiContract
10+
{
11+
[HttpGetMarker]
12+
Task<ApiResult<Attachment>> GetFileMetaData([FromHeader]long attachmentId);
13+
14+
[HttpPutMarker]
15+
Task<ApiResult<bool>> PutSubtitleAttachmentList([FromBody] SubtitleAttachmentDto attachments);
16+
}
17+
}

test/NetCoreStack.Proxy.Test.Contracts/NetCoreStack.Proxy.Test.Contracts.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
8+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.3" />
99
<PackageReference Include="NetCoreStack.Contracts" Version="2.0.7" />
10+
<PackageReference Include="NetCoreStack.Mvc" Version="2.1.2" />
1011
</ItemGroup>
1112

1213
</Project>

test/NetCoreStack.Proxy.Tests/NetCoreStack.Proxy.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
11-
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.1" />
12-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
13-
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.1" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
11+
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.2" />
12+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.3" />
13+
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.2" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
1515
<PackageReference Include="Moq" Version="4.8.2" />
1616
<PackageReference Include="xunit" Version="2.3.1" />
1717
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

test/NetCoreStack.Proxy.Tests/ProxyCreationTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,5 +317,27 @@ public async Task SelfApiWithThisOperation()
317317
await selfApi.Operation(baz);
318318
Assert.True(true);
319319
}
320+
321+
[Fact]
322+
public async Task AttachmentApiTests()
323+
{
324+
var api = Resolver.GetService<IAttachmentApi>();
325+
await api.PutSubtitleAttachmentList(new SubtitleAttachmentDto {
326+
SubtitleAttachmentList = new List<SubtitleAttachment>
327+
{
328+
new SubtitleAttachment
329+
{
330+
Attachment = new Attachment
331+
{
332+
Name = "Some attachment",
333+
Content = "Lorem ipsum dolar sit amet"
334+
},
335+
CategoryId = 2,
336+
SeasonId = 1
337+
}
338+
}
339+
});
340+
Assert.True(true);
341+
}
320342
}
321343
}

0 commit comments

Comments
 (0)