in

Community

Take part in the community surrounding CodeBreeze and other products from SteelBlue Solutions.
Latest post 12-16-2009 11:49 AM by Joseph Baggett. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-05-2009 11:36 PM

    Extensibility

    Is it possible to write a CodeBreeze Module that would allow one to interrogate the Indexes/Indices on a Table, and what columns make up a given Index?  I was thinking one would have to hook into the BusinessEntityCreation delegate for this, but the Table property does not expose an Indexes property, which is what I had in mind.  Would this require writing a custom SchemaProvider?

    Similarly, on a TableColumn, I would like to know if it has a foreign key constraint in the database, and what table is the "parent" of this foreign key contstaint.  So in the same way as what TableColumn has a property called IsPrimaryKey, I'd like to be able to call on a property called "IsBoundByForeignKeyConstraint"; if this property returns True I'd like to be able to call on a property called "ForeignKeyParentTable", and "ForeignKeyParentTableColumn".  I see an interesting use of e.EntityField.State in the "Precision and Scale Inserter" example provided, and I guess I can leverage this Scale property to add this foreign key information as key/value pairs...but the problem is that I would need e.TableColumn to expose these properties like it exposes Scale and Precision.  Is this the kind of thing that can be achieved by writing a custom SchemaProvider?

    Some advice would be appreciated.

    Thanks,

    Shawn.

     

  • 12-16-2009 11:49 AM In reply to

    Re: Extensibility

    Me personally, I am against generating code off of the indexes for a few reasons.  One, they can be removed for performance, which could cause you to do a generate, copy paste, etc.  If you want to use the indexes, I would assume you would need to add the SQL in your provider to do so, and add it to the State property of for the EntityField objects just like the precision/scale is being handled.  Off of indexes though, you would probably need to return back if it is unique or not to determine whether or not you are returning back a collection or an object as well.

    I personally use target tags, because it is contained in the generator.  I know some work environments that may have "help tickets" can slow down development, so I think the generation should be as decoupled away from the database as much as possible.

    Anyways, this is just my opinion.  Let me know if you need help.

Page 1 of 1 (2 items)
2008 - All rights reserved
Powered by Community Server (Commercial Edition), by Telligent Systems