I am soon going to be writing a component that takes metadata and generates dynamic SQL from it. Mostly we're talking SELECT, INSERT, UPDATE, DELETE stuff but I suppose it's possible to have some CREATE/ALTER TABLE statements in there too.
I'm assured that no existing ORM solution fits the bill but otherwise the details on what where and how are still a little hazy.
I can write a SQL statement same as any other developer and have used NHibernate a little in the past but I know next to nothing of the theory behind databases or ORMs. I'd like to get my prep-work in so I'm looking for any suggested reading or code to go through.
By the way my coding environment is .NET (C#) and SQL Server.