@@ -27,39 +27,39 @@ public class VisualBasicGenerator : AbstractGenerator
2727
2828Namespace SqlMarshal.Annotations
2929
30- <System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple:=True)>
31- Friend NotInheritable Class SqlMarshalAttribute
32- Inherits System.Attribute
30+ <System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple:=True)>
31+ Friend NotInheritable Class SqlMarshalAttribute
32+ Inherits System.Attribute
3333
34- Public Sub New()
35- StoredProcedureName = """"
36- End Sub
34+ Public Sub New()
35+ StoredProcedureName = """"
36+ End Sub
3737
38- Public Sub New(name As String)
39- StoredProcedureName = name
40- End Sub
38+ Public Sub New(name As String)
39+ StoredProcedureName = name
40+ End Sub
4141
42- Public Property StoredProcedureName As String
43- End Class
42+ Public Property StoredProcedureName As String
43+ End Class
4444
45- <System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple:=False)>
46- Friend NotInheritable Class RawSqlAttribute
47- Inherits System.Attribute
45+ <System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple:=False)>
46+ Friend NotInheritable Class RawSqlAttribute
47+ Inherits System.Attribute
4848
49- Public Sub New()
50- End Sub
51- End Class
49+ Public Sub New()
50+ End Sub
51+ End Class
5252
53- <System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple:=False)>
54- Friend NotInheritable Class RepositoryAttribute
55- Inherits System.Attribute
53+ <System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple:=False)>
54+ Friend NotInheritable Class RepositoryAttribute
55+ Inherits System.Attribute
5656
57- Public Sub New(entityType As System.Type)
58- EntityType = entityType
59- End Sub
57+ Public Sub New(entityType As System.Type)
58+ EntityType = entityType
59+ End Sub
6060
61- Public Property EntityType As System.Type
62- End Class
61+ Public Property EntityType As System.Type
62+ End Class
6363
6464End Namespace
6565" ;
@@ -75,7 +75,16 @@ public override void Initialize(GeneratorInitializationContext context)
7575 }
7676
7777 /// <inheritdoc/>
78- protected override SyntaxNode GetParameterDeclaration ( IMethodSymbol methodSymbol , IParameterSymbol parameter , int index )
78+ protected override SyntaxNode GetParameters ( IMethodSymbol methodSymbol )
79+ {
80+ var parametersNodes = methodSymbol . Parameters . Select ( ( parameterSymbol , index ) => GetParameterDeclaration ( methodSymbol , parameterSymbol , index ) ) ;
81+ var separatedList = methodSymbol . Parameters . Length == 0
82+ ? SeparatedList < ParameterSyntax > ( )
83+ : SeparatedList ( parametersNodes , methodSymbol . Parameters . Take ( methodSymbol . Parameters . Length - 1 ) . Select ( _ => Token ( SyntaxKind . CommaToken ) . WithTrailingTrivia ( Whitespace ( " " ) ) ) ) ;
84+ return ParameterList ( separatedList ) ;
85+ }
86+
87+ private static ParameterSyntax GetParameterDeclaration ( IMethodSymbol methodSymbol , IParameterSymbol parameter , int index )
7988 {
8089 var typeAsClause = SimpleAsClause ( ParseTypeName ( parameter . Type . ToDisplayString ( ) ) . WithLeadingTrivia ( Whitespace ( " " ) ) ) ;
8190 if ( parameter . RefKind == RefKind . Out )
@@ -111,12 +120,12 @@ public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
111120 return ;
112121 }
113122
114- if ( methodSymbol . GetAttributes ( ) . Any ( ad => ad . AttributeClass ? . ToDisplayString ( ) == "SqlMarshalAttribute" ) )
123+ if ( methodSymbol . GetAttributes ( ) . Any ( ad => ad . AttributeClass ? . ToDisplayString ( ) == "SqlMarshal.Annotations. SqlMarshalAttribute" ) )
115124 {
116125 this . Methods . Add ( methodSymbol ) ;
117126 }
118127
119- if ( methodSymbol . ContainingType . GetAttributes ( ) . Any ( ad => ad . AttributeClass ? . ToDisplayString ( ) == "RepositoryAttribute" ) )
128+ if ( methodSymbol . ContainingType . GetAttributes ( ) . Any ( ad => ad . AttributeClass ? . ToDisplayString ( ) == "SqlMarshal.Annotations. RepositoryAttribute" ) )
120129 {
121130 this . Methods . Add ( methodSymbol ) ;
122131 }
0 commit comments