ThunderSpark91
ThunderSpark91
CC#
Created by ThunderSpark91 on 8/18/2024 in #help
✅ Need help fixing my C# Html Extraction Code
No description
3 replies
CC#
Created by ThunderSpark91 on 8/16/2024 in #help
Entity Framework: Define a string computed Primary Key column in Data Annotations
Table structure in ERD.
18 replies
CC#
Created by ThunderSpark91 on 7/23/2024 in #help
IConfiguration using the json string/Data Model directly, instead of saving to a temporary file?
Currently my code now works like this, where I have a JSON file going being added to the IConfiguration like this and then send that configuration through my service to be used. public static string FilePath = Path.Join(Environment.CurrentDirectory); IConfiguration configuration = new ConfigurationBuilder() .AddJsonFile($"appsettings.json") .AddEnvironmentVariables() .Build(); BaseCoreService BCS = new BCS( configuration, filepath) BCS.StartTheService(); public BaseCoreService(IConfiguration configuration, string filepath) { CustomFunction(Configuration, filepath) // Custom Code here } I am migrating to use a JSON string. To still be able to reuse my code somewhat, I cd save that JSON string to a Temporary File. public BaseCoreService(string JSONString, string filepath) : base(filepath) { string JsonFolderPath = Path.Join(filepath, "JSON"); string JsonFilePath = Path.Combine(JsonFolderPath, "Settings.json"); WriteAllTextToFile(JsonFilePath, JSONString); IConfiguration Testconfiguration = new ConfigurationBuilder() .AddJsonFile(JsonFilePath) .AddEnvironmentVariables() .Build(); CustomFunction(Configuration, filepath) File.Delete(JsonFilePath) // Custom Code here } However I actually do not want that. I want to rely on as less files as possible. i can delete the file just afterwards. But If I can skip the file creation of the json string that is all the better.
30 replies