I had an idea for a web app where I will want the user to create their own database trhought a web application, with their own tables names and fields types.
I thought about creating a database structure using Object Oriented Programming so that a pre made database will support all kinds of Entities with custom properties. Something like this:
CustomType
{
public long TypeId {get;set;}
public string ActiveType {get;set;}
}
CustomProperty
{
public int wholeNumber {get;set;}
public string text {get;set;}
public bool boolean {get;set;}
public decimal dec {get;set;}
//Choosen Id of the type to work with
public long TypeId {get;set;}
public bool wholeNumber_ACTIVE {get;set;}
public bool text_ACTIVE {get;set;}
public bool boolean_ACTIVE {get;set;}
public bool dec_ACTIVE {get;set;}
}
CustomEntity
{
public string TableName {get;set;}
public CustomProperty Prop01 {get;set;}
public CustomProperty Prop02 {get;set;}
public CustomProperty Prop03 {get;set;}
public CustomProperty Prop04 {get;set;}
public CustomProperty Prop05 {get;set;}
}
The idea behind this is to let the user decide what they want their database to store, on a pre-made database for them to work with, without having to create it during Runtime since this is a web app.
I beleive I can manage it like this for them to store whatever they need but I'm also thinking about the following issues:
-
How will I manage relationships when the user needs to link tables with Ids and foreing keys. (I though about managing a
public long ForeingId {get;set;}and just store the Id they need to associate). -
How Will I manage querys since tables will have CodeNames and each will have a different meaning or each person that sets it up. (I though about, renaming the table during Runtime, but im afraid of errors and DB corruption).
-
Also thought about sending direct querys to create the database according to users need, but then again not experienced users can really mess up here or find it hard to manage.
-
How can I manage migration or DB changes with code instead of the use of Powershell console.
-
If we have multiple users each with a unique database but same web app how can we manage webconfigs to work with this idea.
I know theres a lot of questions here, im looking for the best way to achive this, having multiple users own their small web app through the internet using MVC pattern and lots of options trhough a browser.
Thanks in advance for your suggestions! :)
Aucun commentaire:
Enregistrer un commentaire