none
SQL Metal Changes Column Name in DBML file Generated From SQL CE 3.5 database RRS feed

  • Question

  • When I run Sqlmetal to create a dbml file where a table contains a column with same name as the table, the resultant dbml file changes the column name and appends a 1 at the end.  For example, the database contains a table named Driver.  The driver table has 2 columns i.e. an auto-incrementing ID column and an nvarchar(50) column named Driver.  The dbml file renames the Driver column to Driver1!!  What is causing this?  I am using SQL CE version 3.5 as the database.
    Monday, September 13, 2010 10:10 PM

Answers

  • .net don't allow members to have the same name as the type they belong to, e.g. a property with the same name as the class it is a member of. To avoid a compile error, SQLMetal (and the designer) renames the member mapped to columns using the same name as the table & class they belong to.
     
       Cool tools for Linq-to-SQL and Entity Framework 4:
     huagati.com/dbmltools - Rule based class and property naming, Compare and Sync model <=> DB, Sync SSDL <=> CSDL (EF4)
     huagati.com/L2SProfiler - Query profiler for Linq-to-SQL and Entity Framework v4
    • Proposed as answer by KristoferAEditor Tuesday, September 14, 2010 10:36 AM
    • Marked as answer by Mike_G_H Tuesday, September 14, 2010 5:07 PM
    Tuesday, September 14, 2010 12:47 AM
    Answerer