Fix namespace model provider
This commit is contained in:
parent
9ba01f0c35
commit
f999ac5929
|
@ -20,8 +20,7 @@ namespace BlueWest.EfMethods
|
||||||
internal class EfGeneratorContext
|
internal class EfGeneratorContext
|
||||||
{
|
{
|
||||||
private readonly List<SymbolDisplayPart> _ignoredNamespaces;
|
private readonly List<SymbolDisplayPart> _ignoredNamespaces;
|
||||||
|
|
||||||
|
|
||||||
public ImmutableArray<Diagnostic> Diagnostics { get; private set; }
|
public ImmutableArray<Diagnostic> Diagnostics { get; private set; }
|
||||||
public EfMethodsModel? Model { get; private set; }
|
public EfMethodsModel? Model { get; private set; }
|
||||||
protected Compilation Compilation { get; }
|
protected Compilation Compilation { get; }
|
||||||
|
@ -32,6 +31,8 @@ namespace BlueWest.EfMethods
|
||||||
protected INamedTypeSymbol EfUpdateMethodsTypeSymbol { get; }
|
protected INamedTypeSymbol EfUpdateMethodsTypeSymbol { get; }
|
||||||
protected INamedTypeSymbol EfAddMethodsTypeSymbol { get; }
|
protected INamedTypeSymbol EfAddMethodsTypeSymbol { get; }
|
||||||
|
|
||||||
|
protected INamedTypeSymbol EfGeneratorTypeSymbol { get; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected EfGeneratorContext(
|
protected EfGeneratorContext(
|
||||||
|
@ -46,6 +47,7 @@ namespace BlueWest.EfMethods
|
||||||
SourceGenerationOptions = sourceGenerationOptions;
|
SourceGenerationOptions = sourceGenerationOptions;
|
||||||
TypeSyntax = typeSyntax;
|
TypeSyntax = typeSyntax;
|
||||||
EfUpdateMethodsTypeSymbol = compilation.GetTypeByMetadataNameOrThrow(EfUpdateMethodsAttributeSource.FullyQualifiedName);
|
EfUpdateMethodsTypeSymbol = compilation.GetTypeByMetadataNameOrThrow(EfUpdateMethodsAttributeSource.FullyQualifiedName);
|
||||||
|
EfGeneratorTypeSymbol = compilation.GetTypeByMetadataNameOrThrow(EfGeneratorAttributeSource.FullyQualifiedName);
|
||||||
EfAddMethodsTypeSymbol = compilation.GetTypeByMetadataNameOrThrow(EfAddMethodsAttributeSource.FullyQualifiedName);
|
EfAddMethodsTypeSymbol = compilation.GetTypeByMetadataNameOrThrow(EfAddMethodsAttributeSource.FullyQualifiedName);
|
||||||
AddUsingIfRequired(sourceGenerationOptions.SupportNullableStaticAnalysis, "System.Diagnostics.CodeAnalysis");
|
AddUsingIfRequired(sourceGenerationOptions.SupportNullableStaticAnalysis, "System.Diagnostics.CodeAnalysis");
|
||||||
}
|
}
|
||||||
|
@ -259,13 +261,14 @@ namespace BlueWest.EfMethods
|
||||||
|
|
||||||
// get containing class type information
|
// get containing class type information
|
||||||
ClassDeclarationSyntax classDeclarationSyntax = (TypeSyntax as ClassDeclarationSyntax)!;
|
ClassDeclarationSyntax classDeclarationSyntax = (TypeSyntax as ClassDeclarationSyntax)!;
|
||||||
|
|
||||||
|
var classDeclarationTypeInfo = semanticModel.GetTypeInfo(classDeclarationSyntax);
|
||||||
|
|
||||||
// context name
|
// context name
|
||||||
var dbContextName = classDeclarationSyntax.Identifier.ValueText;
|
var dbContextName = classDeclarationSyntax.Identifier.ValueText;
|
||||||
var namespaceDeclaration = classDeclarationSyntax.Parent as NamespaceDeclarationSyntax;
|
var contextNamespace = TypeSyntax.GetNamespace();
|
||||||
var contextNamespace = namespaceDeclaration.Name.ToString();
|
|
||||||
var contextTypeFullName = $"{contextNamespace}.{dbContextName}";
|
var contextTypeFullName = $"{contextNamespace}.{dbContextName}";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// handles different attributes
|
// handles different attributes
|
||||||
|
@ -600,8 +603,6 @@ namespace BlueWest.EfMethods
|
||||||
private EfGetOneFromListModel ExtractEfGetOneFromListMethodsModel(MemberDeclarationSyntax uProperty, SemanticModel semanticModel, EfEntityDataModel entityDataModel)
|
private EfGetOneFromListModel ExtractEfGetOneFromListMethodsModel(MemberDeclarationSyntax uProperty, SemanticModel semanticModel, EfEntityDataModel entityDataModel)
|
||||||
{
|
{
|
||||||
|
|
||||||
//SpinWait.SpinUntil(() => Debugger.IsAttached);
|
|
||||||
|
|
||||||
var efTypeofSymbols = GetEntityTypeSymbol(uProperty, EfGetOneFromListAttributeSource.AttributeName, semanticModel);
|
var efTypeofSymbols = GetEntityTypeSymbol(uProperty, EfGetOneFromListAttributeSource.AttributeName, semanticModel);
|
||||||
var attributeSymbol = uProperty.GetAttribute(EfGetOneFromListAttributeSource.AttributeName);
|
var attributeSymbol = uProperty.GetAttribute(EfGetOneFromListAttributeSource.AttributeName);
|
||||||
var keyPropertyName = ExtractNameOfMemberName(uProperty, EfGetOneFromListAttributeSource.AttributeName);
|
var keyPropertyName = ExtractNameOfMemberName(uProperty, EfGetOneFromListAttributeSource.AttributeName);
|
||||||
|
|
|
@ -27,6 +27,9 @@ namespace BlueWest.EfMethods
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Execute(GeneratorExecutionContext context)
|
public void Execute(GeneratorExecutionContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//SpinWait.SpinUntil(() => Debugger.IsAttached);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var options = SourceGenerationOptions.From(context);
|
var options = SourceGenerationOptions.From(context);
|
||||||
|
|
Loading…
Reference in New Issue