TRAP Typegen
More code less talk
Late last night I was working on the TRAP type mapping design and I realized I've reached the point where experimentation and refactoring
will do more good than thinking deep thoughts about the design even more. I've decided to take a crawl --> walk --> fly approach, by which I mean
the easiest feature will be implemented first, moving up to the most complex features. The simplest feature is a
select field1, field2, field3 from table operation, quickly followed
by adding the
Criteria object to the query. From there, 1:1 relationships, then 1:n relationships, then m:n relationships, then the
stored procedure execution path, then some of the
relfection emit optimizations, the stored procedure execution path, etc.
I added some simple code generation to the
Engine assembly the other day. Reducing tedious data access tasks is the goal of this tool and
that includes typing get{} set{} code for properties for classes which closely mirror the database schema a great deal of the time.
Why not just use public fields?, you ask,
Far less typing.
From a Reflection standpoint, Properties and Fields must be treated differently in code, and for TRAP I don't want to create a second execution path for Fields vs. Properties. DataBound UI controls in both WinForms
and WebForms are only set up to look for Indexers (dataRow["field"]) and Properties, and this makes a second good reason to use Properties, even if they have
no intelligence in them. So, here's a shot of the UI generating custom Types from my database schema, which saves me a lot of typing.

br>
Unless you've been under a rock (or are new to MSFT tech) you'll recognize the good ole Northwind database there. I decided to use this for testing and examples, rather than
show more than I'm ready to show about my other projects that are going to be using this tool. I find this sort of ironic, since the Northwind database has been used
in all of the "DataSets and DataReader are the best!" examples I so despise.
When next I open my yap to rap about TRAP I will show the OR Mapper UI in action and some working code.