Strategies for modeling a large (50 ~) number of properties

Scenario

I parse the letters and paste them into the database using ORM (NHibernate, to be precise). Although my current approach works technically, I don't really like it, but I can't find a better solution. The email contains 50 ~ fields and is sent from a third party and looks like this (obviously, a very short sample of a dummy file).

Field #1: Value 1       Field #2: Value 2
Field #3: Value 3       Field #4: Value 4       Field #5: Value 5

Problem

My problem is that when parsing these many fields, the database table is an absolute monster. I can’t create the correct models using any relationships or AFAIK, because each message sent is static data and does not depend on any other sources.

The only idea I have is to find common features between each field and divide them into more manageable pieces. Say 10 ~ fields per entity, so there are only 5 entities. However, I do not really like this idea or see that all I will do is create a one-to-one relationship.

What is a good way to manage a large number of properties that are uncontrollable?

Any thoughts?

+3
source share
3 answers

Create 2 tables: 1 for the main object, and another for the fields. Thus, you can program access to each field as needed, and the object model does not look unpleasant.

But this is just on my head; you have a strange problem.

, , , #, , , html- ( , )

+6

50 , , 50 ( ) . , Type , (IsPublic ..).

:

, , , - TryGetMember ( 50 ). , , , ORM , , intellisense.

, .

+5

Use a dictionary instead of individual fields. In the database, you have a table for the name of the field and its value (and to which object it belongs).

+2
source

All Articles