sql - What should one map strings to in a database ORM? -


It seems that this is an important discrepancy and I'm curious how the typical ORM handles it.

Using the 'Text' column type will theoretically give you more string-like storage, but as I consider it to be the text column queries are not qualified, or at least not efficiently (non-indexed? ).

I'm thinking of using something like NHibernate, but it is relatively simple than my ORM, so if I can write it, for example, SqlServer only stores the actual size of the data. To me, defining large sizes for strings is enough that the user does not recognize the boundary.

Exmaples:

  • Name, person, etc. of a product: 500
  • path, url etc: 1000
  • Comments, Free Text: 2000 or more

There is nothing on the NHibernate Runtime with size, you need to use any type of validator or cut the dashboard either by throwing an exception .

Excerpt: "It is relatively simpler than my ORM" It is difficult to say whether NHibernate is overkill or not normally data access is not normal.

As a simple guide on my head, take NHibernate if:

  • You have a subtle or complex domain ideal.
  • You need some lazy loading
  • You want to become a database independent, eg. Run it on SqlServer or Oracle

If you think that per table is a class you want, you do not actually need ORM.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -