Skip to content

Commit 9958636

Browse files
committed
refactor: fix generator reference and warnings
1 parent 5456cbb commit 9958636

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

samples/WeihanLi.EntityFramework.Sample/DbContextInterceptorSamples.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ private static async Task InterceptorTest2()
4848

4949
file sealed class FileTestDbContext(DbContextOptions<FileTestDbContext> options) : DbContext(options)
5050
{
51-
public DbSet<TestEntity> Entities { get; set; }
51+
public DbSet<TestEntity> Entities { get; set; } = null!;
5252
}
5353

5454
file sealed class TestEntity
5555
{
5656
public int Id { get; set; }
57-
public string Name { get; set; }
57+
public string? Name { get; set; }
5858
}
5959

6060
file sealed class SavingInterceptor : SaveChangesInterceptor

samples/WeihanLi.EntityFramework.Sample/WeihanLi.EntityFramework.Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<ProjectReference Include="..\WeihanLi.EntityFramework.SourceGenerator\WeihanLi.EntityFramework.SourceGenerator.csproj" OutputItemType="analyzer" ReferenceOutputAssembly="false" />
15+
<ProjectReference Include="..\..\src\WeihanLi.EntityFramework.SourceGenerator\WeihanLi.EntityFramework.SourceGenerator.csproj" OutputItemType="analyzer" ReferenceOutputAssembly="false" />
1616
</ItemGroup>
1717

1818
</Project>

src/WeihanLi.EntityFramework.SourceGenerator/EFExtensionsGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public sealed class EFExtensionsGenerator : IIncrementalGenerator
1313
namespace WeihanLi.EntityFramework
1414
{
1515
[AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
16-
public sealed class EFExtensionsAttribute;
16+
public sealed class EFExtensionsAttribute;
1717
}
1818
""";
1919

@@ -39,7 +39,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
3939
var dbContextName = dbContextDeclaration!.Identifier.Text;
4040
var repositoryNamespace = dbContextDeclaration.Parent!.GetNamespace();
4141
var generatedCode = GenerateRepositoryCode(dbContextName, repositoryNamespace, templates);
42-
spc.AddSource($"{dbContextName}Repository.g.cs", SourceText.From(generatedCode, Encoding.UTF8));
42+
// spc.AddSource($"{dbContextName}Repository.g.cs", SourceText.From(generatedCode, Encoding.UTF8));
4343
});
4444
}
4545

0 commit comments

Comments
 (0)