Skip to content

Commit 49a2ce6

Browse files
committed
Common
- fixed using/import to itself
1 parent b474a60 commit 49a2ce6

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

Common/Templates/Structural/FileTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public IEnumerable<UsingTemplate> GetUsingsByTypeAndPath()
6262
{
6363
foreach (UsingTemplate usingTemplate in this.GetUsings(namespaceChildren))
6464
{
65-
if (this.Name == usingTemplate.Type)
65+
if (namespaceTemplate.Children.Any(x => x.Name == usingTemplate.Type))
6666
{
6767
continue;
6868
}

Common/Templates/Structural/LinkedUsingTemplate.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
using System.Diagnostics;
12
using KY.Generator.Transfer;
23

34
namespace KY.Generator.Templates
45
{
6+
[DebuggerDisplay("Using {Type} (linked)")]
57
public class LinkedUsingTemplate : UsingTemplate
68
{
79
private readonly TypeTransferObject type;

Common/Templates/Structural/UsingTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace KY.Generator.Templates
44
{
5-
[DebuggerDisplay("Using {Namespace}")]
5+
[DebuggerDisplay("Using {Namespace} {Type}")]
66
public class UsingTemplate : ICodeFragment
77
{
88
public virtual string Namespace { get; }

Common/Transfer/Writers/TransferWriter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ protected virtual FieldTemplate AddField(ModelTransferObject model, MemberTransf
126126
{
127127
this.MapType(model.Language, fieldOptions.Language, member.Type);
128128
}
129-
if (member.Type != model)
130-
{
131-
this.AddUsing(member.Type, classTemplate, fieldOptions);
132-
}
129+
this.AddUsing(member.Type, classTemplate, fieldOptions);
133130
FieldTemplate fieldTemplate = classTemplate.AddField(member.Name, member.Type.ToTemplate()).Public().FormatName(fieldOptions)
134131
.WithComment(member.Comment);
135132
if (fieldOptions.WithOptionalProperties)

0 commit comments

Comments
 (0)