.net - NHibernate - Custom render a column name on SQL -


i have 2 tables, say:

mytable                         myfktable ---------------------------     -------------------------- id             numeric(3,0)     id             varchar(3) description    varchar(100)     description    varchar(100) fk_id          char(3) 

note in example, mytable.fk_id references myfktable.id, respective datatypes don't match.

so, when have trimmed id string value in myfktable, need join both tables way:

select (...)  mytable       inner join myfktable on (mytable.fk_id = cast(myfktable.id char(3)) (...) 

the question:

is there way "quote" (surround) column name specific sql function (in case, cast function)?

i've found following difficulties researching this:

  • i create specific dialect, great, because can switch in configurations when normalize database. problem is, quote , related overridable functions won't give me enough information table each column nor tells me da column-to-be-quoted datatype;

  • i create specifica iusertype these cases, none of methods implemented step in how column name in rendered in final sql.

  • i know can set sql column name (how render) via mapping, wish avoid solution check if there other ways of doing this.

what possibilities?

disclaimer

i'm aware should normalize database schema - unfortunately, i'm not allowed @ present moment. i'm aware not best solution, or might incur in performance issues. i'm curious if type of adaptation in nhibernate real possibility.


Comments

Popular posts from this blog

How can I fetch data from a web server in an android application? -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -

jquery - How can I dynamically add a browser tab? -