コード例 #1
0
        private async Task <Document> InitializeWithDefaults(Document document, InitializerExpressionSyntax objectInitializer, CancellationToken cancellationToken)
        {
            var semanticModel = await document.GetSemanticModelAsync(cancellationToken);

            var syntaxGenerator     = SyntaxGenerator.GetGenerator(document);
            var mappingSourceFinder = new ScaffoldingSourceFinder(syntaxGenerator, document);

            return(await ReplaceEmptyInitializationBlock(document, objectInitializer, cancellationToken, semanticModel, mappingSourceFinder, syntaxGenerator));
        }
        private async Task <Document> ScaffoldInvocation(Document document, IInvocation invocation, bool namedArguments,
                                                         CancellationToken cancellationToken)
        {
            var syntaxGenerator = SyntaxGenerator.GetGenerator(document);
            var semanticModel   = await document.GetSemanticModelAsync(cancellationToken);

            var contextAssembly     = semanticModel.FindContextAssembly(invocation.SourceNode);
            var mappingSourceFinder = new ScaffoldingSourceFinder(syntaxGenerator, document, contextAssembly);

            return(await CodeFixHelper.FixInvocationWithParameters(document, invocation, namedArguments, semanticModel, mappingSourceFinder, cancellationToken));
        }