c# - Dynamic Class To Support User-Defined Database Fields -


I am currently developing a WCF service in C # to serve as the basic API for an existing internal app I am The API I am developing specifically focuses on adding and removing records from the database.

However, the app allows end-users to change existing database structure by adding custom fields to each table.

This means that a departmental customer table can look like this:

  Id. First name Last name | City | State | FavColor  

While other departments' customer table looks like this:

  Id | First name Last name | City | State | FavFood | FavMovie  

Which class can I design to support the given user-defined (FAV) field given structure?

I have user-defined fields:

  public class customer {public entry ID (get; set;} public string first name {received; set;} public string LastName {Get; set;} Public string city {receipt; set;} public string state {get; set;} public dictionary & lt; string, string & gt; UserDefinedFields {get; set;}}  

Is it better to handle this requirement (ie more installation / Best practice)?

If you were roaming the defined fields then you would have been well One type of descriminator can be served with heritage, I'll dig out a Martian Fowler article for it. However, to use a vertical table (known as unit attribute value), expandability I have something like that in the past It has just worked fine.

Edit: It has happened to me that you can sort this example and add it as a blob / text as a persistent medium. . In this way you can be quite dull about the schema. I think a document like DOC, such as Mojo would be good for a Blob field in this type of thing or MSSQL


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -