Skip to content

Instantly share code, notes, and snippets.

@J-Graham
Created October 22, 2020 02:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save J-Graham/2dbed1e14524a1b95b4a2faf1cc44901 to your computer and use it in GitHub Desktop.
Customer Backend Model JSON
{
"Customer": {
"Customer": {
"name": "Customer",
"module": true,
"subEntity": false,
"extends": ["Entity", "Versionable"],
"properties": [
{
"name": "Name",
"type": "string",
"sqlType": "varchar",
"maxLength": "50"
},
{
"name": "StatusId",
"type": "int",
"sqlType": "int"
},
{
"name": "SourceId",
"type": "int",
"sqlType": "int"
}
],
"reverseNav": [
{
"name": "Contacts",
"type": "Contact"
},
{
"name": "CustomerAddresses",
"type": "CustomerAddress"
},
{
"name": "CustomerPhones",
"type": "CustomerPhone"
},
{
"name": "Documents",
"type": "Document"
},
{
"name": "Notes",
"type": "Note"
}
],
"foreignKeys": [
{
"name": "FK_Customers_CustomerSources",
"type": "CustomerSource"
},
{
"name": "FK_Customers_CustomerStatuses",
"type": "CustomerStatus"
}
]
}
}
}
@vitale232
Copy link

Hey John, thanks for sharing this! If I remember correctly from the Pod, you are using SQL Server as your db.

Are you using a custom SQL script to output this JSON? I've done some googling, and this is the most relevant doc I've found. Would you suggest starting with the queries there and adapting them or ...? What's a good way to get started?

Also, have you seen Formly? It's really easy to use and solves a similar problem. I was able to go from this metadata schema to a Form in no time! Now I'm addicted 🤭, and want to be able to use it against our custom dbs.

@J-Graham
Copy link
Author

Hiya, thanks for checking it out and listening! We actually extended a tool we use to generate the Backend Models as well (for c#) call a reverse POCO generator. We took this and wrote our own T4 template to extend the queries they already wrote. I think your SQL-JSON link is pretty promising and worth checking out. Ours was kind of specific because we were already using that tool so it made sense to leverage it.

I have heard of Formly, back when we started it just didn't do what we needed, but it seems great now. We have a lot of custom components that we want to push in and having the flexibility to control the engine has been nice, but it is a lot of work to keep up with 😄 . Glad you're taking the plunge it has been a game changer for use, let us know how it works out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment