private ProxyModel GetModel(ClassDeclarationSyntax classSyntax, Compilation compilation) { var root = classSyntax.GetCompilationUnit(); var classSemanticModel = compilation.GetSemanticModel(classSyntax.SyntaxTree); var classSymbol = classSemanticModel.GetDeclaredSymbol(classSyntax); var proxyModel = new ProxyModel { ClassBase = classSyntax.GetClassName(), ClassName = $"{classSyntax.GetClassName()}{ProxyAttribute.Name}", ClassModifier = classSyntax.GetClassModifier(), Usings = root.GetUsings(), Namespace = root.GetNamespace(), Commands = GetMethodWithParameter(classSyntax, classSemanticModel, nameof(Command)), Queries = GetMethodWithParameter(classSyntax, classSemanticModel, nameof(Query)), Events = GetMethodWithParameter(classSyntax, classSemanticModel, nameof(Event)), ConstructorParameters = GetConstructor(classSymbol), InjectedProperties = GetInjectedProperties(classSymbol), Subscriptions = GetSubscriptions(classSyntax, classSemanticModel) }; return(proxyModel); }
public static AlpakaEventModel From(ClassDeclarationSyntax classSyntax, Compilation compilation) { var root = classSyntax.GetCompilationUnit(); var classSemanticModel = compilation.GetSemanticModel(classSyntax.SyntaxTree); var classSymbol = classSemanticModel.GetDeclaredSymbol(classSyntax); return(new AlpakaEventModel() { EventName = $"{classSyntax.GetClassName()}", Usings = root.GetUsings(), Namespace = root.GetNamespace(), }); }