Template to Generate Metadata

Template to Generate Metadata

Old forum URL: forums.lhotka.net/forums/t/1808.aspx


wjcomeaux posted on Tuesday, November 21, 2006

Ok, I've now got a working version of a template that generates a metadata file.

The template requires a table in the target database called OrmDefinition.

Each row in the table specifies a CSLA BO to be generated. You can look in the template file to see the specification of the table. Some things it allows.

ObjectName, TableToGenerateFrom, ExcludedColumns, ReadOnlyColumns, CSLAPropertyNames, FieldsForCRUD operations and other stuff. (Above names not actual, see template file for actual table column names).

If you guys would like it for the Contrib or if anyone else wants a copy just let me know. It I am currently using it to generate a set of 15 business objects from the PTracker database and they all compile. I have not formally tested the output code yet but it's the same as if you would generate these objects one at a time using the other templates.

Will

P.S. Thanks to all for your help in understanding CSLA and Codesmith and for your continued patience. I'm still learning. :)

Let me know where I should send the template.

wjcomeaux replied on Wednesday, November 22, 2006

I've also just completed a template that generates all of the stored procedures defined in the metadata.

Basically, each row in the database table represents an object. There are columns that define the stored procedure names to use for all the procedures. My script checks each row and if a column is not DBNull.Value then I execute the template to generate the sproc for the table indicated on the current row.

So, for instance, I have a row with this data (more data is available in the record)

ObjectName NamespaceTable CSLAType InsertCommand FetchCommand UpdateCommand DeleteCommand
BuildingER MyCSLA Building EditableRoot gen_BuildingER_Insert gen_BuildingER_Fetch gen_BuildingER_Update gen_BuildingER_Delete

The record also has columns for FetchByForeignKey, DeleteByForeignKey, etc but I exclude them here for brevity.

You guys are welcome to this is you want it.

The table setup would be very easy to wrap a front end around for actually entering the ORM data but I just plan to key it in by hand for now.

Will

Copyright (c) Marimer LLC