I have the below class
public class OracleStoredProcedures
{
public static readonly string GET_ALL_PRODUCTS_BY_ID = $"{PRODUCT_PACKAGE_NAME}.GET_ALL_PRODUCTS_BY_ID";
public static readonly string GET_LATEST_PRODUCTS = $"{PRODUCT_PACKAGE_NAME}.GET_LATEST_PRODUCTS";
public static readonly string GET_ADDRESS_BY_ID = $"{ADDRESS_PACKAGE_NAME}.GET_ADDRESS_BY_ID";
private static readonly string PRODUCT_PACKAGE_NAME = "DATABASE.PRODUCT_PKG";
private static readonly string ADDRESS_PACKAGE_NAME = "DATABASE.ADDRESS_PKG";
}
I am having the issue when trying to call the field
var getProducts = OracleStoredProcedures.GET_LATEST_PRODUCTS;
So, I did google search and found the same issue here Order of Static Constructor/Initializers in C#
In my case, these are just packages and stored procedures, not doing any complex things. I am having multiple packages and stored procedures and I just gave two as examples.
So, what is the best way to write and call these from anywhere in the code base ?