0

What are my options if I have a multi tenant application that provides broad platform (accounts/user management billing/etc) services for a given user base but which requires the user to define certain aspects of the application data model within their tenancy?

So say the application provides the platform services to automotive mechanics and the same services to orchidists but within each of their respective tenancies within the app, each of the different user groups (mechanics/orchidists) needs to define models that represent their industry.

Since I am no expert in every or perhaps any industry it does not make sense for me to define the models that allow end users to search for services within any given tenancy. Instead I would like to turn that over to the tenants (mechanics, orchidists) to define their models (say engine number, make, model for mechanics) and (fruit, color, weight, variety for orchadists) that search would be run against.

I can think of simple models like define 100 free fields and allow the tenants to occupy them with their data fields but I hate even the idea of this. I would to somehow come up with some strongly type dynamic method of allowing the tenants to define the models that are also highly searchable and indeed comparable within any given tenancy.

rism
  • 11,932
  • 16
  • 76
  • 116

1 Answers1

0

A possible path is to implement an editor for the users to declare the fields and the types. And then use Reflection.Emit to create a class representing the model at runtime.

Dynamically create a class in C#

Community
  • 1
  • 1
JonPall
  • 814
  • 4
  • 9