Prepare getone template
This commit is contained in:
parent
fa3dfc8e86
commit
1de6350c7d
|
@ -50,20 +50,13 @@ namespace MapTo
|
|||
|
||||
private static void AddGeneratedExtensions(GeneratorExecutionContext context, Compilation compilation, IEnumerable<TypeDeclarationSyntax> candidateMembers, SourceGenerationOptions options)
|
||||
{
|
||||
|
||||
string addSourceTemplate = GetCsxMethodTemplate(context, "AddToEntityTemplate");
|
||||
string updateSourceTemplate = GetCsxMethodTemplate(context, "UpdateEntityTemplate");
|
||||
string getOneByTemplate = GetCsxMethodTemplate(context, "GetOneByTemplate");
|
||||
|
||||
foreach (var candidateMember in candidateMembers)
|
||||
{
|
||||
string addSourceTemplate = context.AdditionalFiles
|
||||
.FirstOrDefault(x => x.Path.Contains("AddToEntityTemplate"))?
|
||||
.GetText()?
|
||||
.ToString() ?? string.Empty;
|
||||
|
||||
string updateSourceTemplate = context.AdditionalFiles
|
||||
.FirstOrDefault(x => x.Path.Contains("UpdateEntityTemplate"))?
|
||||
.GetText()?
|
||||
.ToString() ?? string.Empty;
|
||||
|
||||
|
||||
|
||||
var mappingContext = EfGeneratorContext.Create(compilation, options, candidateMember);
|
||||
|
||||
mappingContext.Diagnostics.ForEach(context.ReportDiagnostic);
|
||||
|
@ -82,5 +75,14 @@ namespace MapTo
|
|||
context.AddSource(hintName, source);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetCsxMethodTemplate(GeneratorExecutionContext context, string templateName)
|
||||
{
|
||||
return context.AdditionalFiles
|
||||
.FirstOrDefault(x => x.Path.Contains(templateName))?
|
||||
.GetText()?
|
||||
.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue