At work, we have multiple telegrams to communicate with a customer. Those telegrams are always different with each customer, but the logic, how we work with them is always the same. The data is sent to a table on our schema with other data for example like sent time and telegram type. We split it into a view to simplify it for development and testing purpose.
Example JSON:
{"Prop1": "Test"}
Example view script (using Oracle Enterprise):
CREATE OR REPLACE VIEW test
AS
SELECT prop1
FROM telegram
, JSON_TABLE (
telegram.json,
'$' COLUMNS (
prop1 PATH '$.Prop1'
)
)
My problem is now, that I do not know the correct or good way to create those view scripts with C#. Currently, I use a constant string with placeholders ({0}, {1}, ...) but they are getting really hard to maintain. I also read about T4, but it is only useable with Visual Studio. AFAIK we plan to move to .NET 5 and it looks like T4 is not available anymore and/or you cannot call the created C# classes in the code without some errors. I heard about Roslyn, too. Is it possible to create .txt/.sql instead of .cs files? I hope I got all the information needed to answer this question. If I forgot some information, tell me. Thanks in advance!