Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / OpenAccess ORM > General Discussions > Whats up with the underscored code generation??

Not answered Whats up with the underscored code generation??

Feed from this thread
  • steve avatar

    Posted on Jan 21, 2012 (permalink)

    Hi all!

    When i create a model first, it seems that upon generation all my fields are getting spliced and underscored.
    So for example, i have a field called 'EmployeeID', but when i generate code to update the DB, it gets named 'Employee_I_D' etc.
    Attached is a picture of the tables i want to create, below is the result that gets generated.

    Could somebody please help me out here? It also does it with fields like 'Date_OUT' -> 'Date_O_U_T' etc.

    Thanks!!


    Generated code:

    -- DGP.ASP.Employee
    CREATE TABLE [Employee] (
        [surname] varchar(255) NULL,            -- _surname
        [street] varchar(255) NULL,             -- _street
        [resource_i_d] int NULL,                -- _resources
        [postalcode] varchar(255) NULL,         -- _postalcode
        [numbr] varchar(255) NULL,              -- _number
        [nme] varchar(255) NULL,                -- _name
        [is_active] tinyint NOT NULL,           -- _isActive
        [CategoryID] int NULL,                  -- _humanTypes
        [floor] varchar(255) NULL,              -- _floor
        [EmployeeID] int IDENTITY NOT NULL,     -- _employeeID
        [date_o_u_t] datetime NOT NULL,         -- _dateOUT
        [date_i_n] datetime NOT NULL,           -- _dateIN
        [country] varchar(255) NULL,            -- _country
        [city] varchar(255) NULL,               -- _city
        [birthplace] varchar(255) NULL,         -- _birthplace
        [birthdate] varchar(255) NULL,          -- _birthdate
        CONSTRAINT [pk_Employee] PRIMARY KEY ([EmployeeID])
    )
    go
     
    -- DGP.ASP.Communication
    CREATE TABLE [communication] (
        [typ] varchar(255) NULL,                -- _type
        [primary] tinyint NOT NULL,             -- _primary
        [employee_i_d] int NULL,                -- _employee
        [content] varchar(255) NULL,            -- _content
        [communication_i_d] int NOT NULL,       -- _communicationID
        CONSTRAINT [pk_communication] PRIMARY KEY ([communication_i_d])
    )
    go
     
    -- DGP.ASP.Human_Types
    CREATE TABLE [human__types] (
        [titel] varchar(255) NULL,              -- _titel
        [main_type_i_d] int NOT NULL,           -- MainTypeID
        [description] varchar(255) NULL,        -- _description
        CONSTRAINT [pk_human__types] PRIMARY KEY ([main_type_i_d])
    )
    go
     
    -- DGP.ASP.Resources
    CREATE TABLE [resources] (
        [titel] varchar(255) NULL,              -- _titel
        [resource_i_d] int NOT NULL,            -- ResourceID
        [description] varchar(255) NULL,        -- _description
        CONSTRAINT [pk_resources] PRIMARY KEY ([resource_i_d])
    )
    go
     
    CREATE INDEX [idx_Employee_CategoryID] ON [Employee]([CategoryID])
    go
     
    CREATE INDEX [idx_Employee_resource_i_d] ON [Employee]([resource_i_d])
    go
     
    CREATE INDEX [idx_communication_employee_i_d] ON [communication]([employee_i_d])
    go
     
    ALTER TABLE [Employee] ADD CONSTRAINT [ref_Employee_human__types] FOREIGN KEY ([CategoryID]) REFERENCES [human__types]([main_type_i_d])
    go
     
    ALTER TABLE [Employee] ADD CONSTRAINT [ref_Employee_resources] FOREIGN KEY ([resource_i_d]) REFERENCES [resources]([resource_i_d])
    go
     
    ALTER TABLE [communication] ADD CONSTRAINT [ref_communication_Employee] FOREIGN KEY ([employee_i_d]) REFERENCES [Employee]([EmployeeID])
    go


    Attached files

    Reply

  • Petar Petar admin's avatar

    Posted on Jan 25, 2012 (permalink)

    Hi steve,

     By default OpenAccess applies an underscore before each capital letter. Unfortunately at the moment there is no way to turn that off. This is an old functionality of the product that is scheduled for improvement in one of the upcoming Q releases of OpenAccess. What we are basically aiming for is to provide a configurable naming settings much like the ones for the reverse mapping scenario. You, as a user will be able to fully control the names that will get generated via those settings. 

    Regards,
    Petar
    the Telerik team

    SP1 for Q3’11 of Telerik OpenAccess ORM is available for download

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / OpenAccess ORM > General Discussions > Whats up with the underscored code generation??
Related resources for "Whats up with the underscored code generation??"

OpenAccess ORM Features  |  Documentation  |  Demos  |  Telerik TV  |  Step-by-step Tutorial   ]