Skip to content

Source generation for databases, influenced by Dapper

License

Notifications You must be signed in to change notification settings

credfeto/credfeto-database-source-generator

Repository files navigation

credfeto-database-source-generator

Database source generator

Using

Add a reference to the Credfeto.Enumeration.Source.Generation package in each project you need the code generation to run.

<ItemGroup>
  <PackageReference 
            Include="Credfeto.Database.Source.Generation" 
            Version="1.1.1.1" 
            PrivateAssets="All" 
            ExcludeAssets="runtime" />
</ItemGroup>

Reference the following package in the project that contains the attributes and interfaces that are used by the generator.

<ItemGroup>
    <PackageReference
            Include="Credfeto.Database.Interfaces"
            Version="1.1.1.1"
            PrivateAssets="All" 
            ExcludeAssets="runtime" />
</ItemGroup>

Viewing Compiler Generated files

Add the following to the csproj file:

  <PropertyGroup>
    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
    <CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
  </PropertyGroup>
  <ItemGroup>
    <!-- Don't include the output from a previous source generator execution into future runs; the */** trick here ensures that there's
    at least one subdirectory, which is our key that it's coming from a source generator as opposed to something that is coming from
    some other tool. -->
    <Compile Remove="$(CompilerGeneratedFilesOutputPath)/*/**/*.cs" />
  </ItemGroup>

Build Status

Branch Status
main Build: Pre-Release
release Build: Release

Changelog

View changelog

Contributors

About

Source generation for databases, influenced by Dapper

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages