Views: 11.8K
Replies: 1
Archived
|
Metadata programming to add Entities and Fields dynamicallyHi,
I would like to use the metadata programming so that it is fast to add fields and entities dynamically to the application using C#. Can anybody guide me in that? The admin user should be able to add fields, define entities and it should automatically reflect in the database and the UI without recompilation. This principle is followed in most of the ERPs. Is there any design pattern for the same? Satyajit Behera, Sep 22, 2010
|
|
Reply 1Satyajit:
This is an area of great interest to me personally. I also was once on a SaaS project where we had to support dynamic fields and entities. In my experience, the database is most tricky part in this (particularly when you try to keep the SQL simple). There are several ways to solve this and this post is really too short to give you a proper answer. Here is one pointer: I have found that the Data Model Resource Book - Volumn 3 is a good starting point for these things from a data model perspective. As far as your code, you could use ADO.NET DataTable objects which are very flexible. Likewise, the UI can detect the columns present in the DataTable and render the correct fields in HTML. SalesForce is a great example of doing this. The admin simply adds custom fields and objects (this is how they call it) and everything magically works, including reporting. Very impressive. My understanding is that they use Oracle which supports this concept of dynamic objects. In SQL Server or any other database there are different ways to support this. Again I can refer to the above mentioned book. There is not such thing as a particular 'Design Pattern' to solve this problem. The problem area is too large for this and will involve numerous patterns and practices. Hope this helps. Dan McMillan, Sep 23, 2010
|