RSCG – Podimo.ConstEmbed
| name | Podimo.ConstEmbed |
| nuget | https://www.nuget.org/packages/Podimo.ConstEmbed/ |
| link | https://github.com/podimo/Podimo.ConstEmbed |
| author | Podimo |
File content transformed to constants
This is how you can use Podimo.ConstEmbed .
The code that you start with is
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Podimo.ConstEmbed" Version="1.0.2" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
<PropertyGroup>
<!-- The namespace under which we generate the constants. -->
<ConstEmbedNamespace>MyAppNamespace</ConstEmbedNamespace>
<!-- The visibility of the classes in which the constants are declared. -->
<ConstEmbedVisibility>public</ConstEmbedVisibility>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="sql/*.sql" ConstEmbed="SQL" />
</ItemGroup>
<ItemGroup>
<None Remove="sql\createDB.sql" />
</ItemGroup>
</Project>
The code that you will use is
Console.WriteLine(MyAppNamespace.SQL.createDB);
create database Andrei; GO; use Andrei; GO;
The code that is generated is
namespace MyAppNamespace
{
public static partial class SQL
{
public const string createDB = @"create database Andrei;
GO;
use Andrei;
GO;
";
}
}
Code and pdf at
https://ignatandrei.github.io/RSCG_Examples/v2/docs/Podimo.ConstEmbed
Leave a Reply