You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you see In c#, I have an Items property of IEnumerable which only requires "Type" Parameter.
But It may also have other properties because Items can contain any class inherited from IBackupInfo.
public interface IBackupInfo
{
string Type { get; }
}
I read the Items, cast them to the appropriate class using the common "Type" property.
How can I programaticly generate the schema file for this, (which is aware of all the class types i provide) ?
The text was updated successfully, but these errors were encountered:
Hello, I am strugling to programaticly generate schema for my configuration and I wondered if there is a practicle way I am missing.
My Example Config file is this
{
"$schema": "config-schema.json" ,
"BackupDir": "c:\backup\",
"CompressionLevel": 2,
"Items": [
{"Type": "File" , "Path" : "c:\SomeDirectory", "ArchiveSize":128 },
{"Type": "File" , "Path" : "c:\SomeDirectory2", "ArchiveSize":128 },
{"Type": "MySQL" , "Server" : "localhost", "DB":"mydata" },
{"Type": "MySQL" , "Server" : "localhost", "DB":"mydb" },
{"Type": "MSSQL" , "Server" : "localhost", "DB":"mymsdb", "Username":"sa", "Password":"...." }
]
}
As you see In c#, I have an Items property of IEnumerable which only requires "Type" Parameter.
But It may also have other properties because Items can contain any class inherited from IBackupInfo.
I read the Items, cast them to the appropriate class using the common "Type" property.
How can I programaticly generate the schema file for this, (which is aware of all the class types i provide) ?
The text was updated successfully, but these errors were encountered: