edit edmx programmatically RRS feed

  • Question

  • The database I'm working with has a table and column naming convention that is best described as a combination of the SCREAMING CAPS and the finger_breaking_underscore casing/naming guidelines.  Because of this, the entities generated by the entity data model wizard aren't pretty.

    Is there an api for editing the edmx and its code behind programmatically?  I need to do something like this:

    foreach entity in the model
           //rename the entity... apply pascal casing (remove SCREAMING_CAPS style table names)

           foreach property on the entity
                    //rename the property... apply pascal casing  (SCREAMING_CAPS style column names)

    Sunday, October 25, 2009 4:48 AM


All replies

  • The edmx file is just xml, so it can be done with XmlDocument, or with Linq-to-XML, etc.

    Alternatively, there are third party tools with this functionality built in; I have an add-in that can do a rule-based mass rename of entitysets/entitytypes/member properties etc; http://www.huagati.com/dbmltools/
    Kristofer - Huagati Systems Co., Ltd.
    Cool tools for Linq-to-SQL and Entity Framework:
    huagati.com/dbmltools (add-in with new features for Visual Studio 2008's L2S and EF designers)
    huagati.com/L2SProfiler (Query profiler for Linq-to-SQL and LLBLGen Pro)
    • Marked as answer by dany0w Monday, October 26, 2009 4:42 PM
    Monday, October 26, 2009 12:24 AM
  • Thanks Kristofer,

    It sounds like your DBML/EDMX tools are exactly what I'm looking for.  I'll download the trial version and evaluate the product.

    Monday, October 26, 2009 2:22 PM