Class, Method and Property names are always in upper case

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
ahamBrahmasmi
Posts: 5
Joined: Sat 23 Jan 2016 08:09

Class, Method and Property names are always in upper case

Post by ahamBrahmasmi » Tue 26 Jan 2016 03:48

Even after changing the settings under Model Settings-->Synchronization-->Model Naming the Class, Method and Property names are always in upper case.

Tried changing all the case settings and it still creates upper case names.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Class, Method and Property names are always in upper case

Post by Shalex » Tue 26 Jan 2016 16:22

1. You are using NHibernate Model, aren't you?

2. The Model Settings-->Synchronization-->Model Naming settings are applied to the NEWLY added objects. The names of existing model objects are left unchanged (until you readd them to the model).

3. Specify the test case for reproducing:
a) the name of the database server you are working with
b) the DDL script of a test table/stored procedure
c) your current Model Settings-->Synchronization-->Model Naming settings
d) the names of model objects created by Entity Developer basing on your database objects

ahamBrahmasmi
Posts: 5
Joined: Sat 23 Jan 2016 08:09

Re: Class, Method and Property names are always in upper case

Post by ahamBrahmasmi » Wed 27 Jan 2016 04:10

Yes I'm using NHibernate Model and creating new model from existing database.

The database is oracle 12c. Below is the DDL of test table

Code: Select all

create table T_Person (
  Id number(9) not null,
  First_Name VARCHAR(20),
  Last_Name VARCHAR(50),
  primary key (Id)
)
Current Model Naming settings is default i.e. Case: set to "FirstLetterUpperCase" for both Class and Method Names and Class Properties' Names and all other setting are same for both.

Also using the Loquacious Mapping template.

Following is the generated code as is including the filenames..
Test.TPERSON.cs

Code: Select all

//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using NHibernate template.
// Code is generated on: 1/26/2016 11:10:00 PM
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace Test.Models
{

    /// <summary>
    /// There are no comments for Test.Models.TPERSON in the schema.
    /// </summary>
    public partial class TPERSON {
    
        #region Extensibility Method Definitions
        
        /// <summary>
        /// There are no comments for OnCreated in the schema.
        /// </summary>
        partial void OnCreated();
        
        #endregion
        /// <summary>
        /// There are no comments for TPERSON constructor in the schema.
        /// </summary>
        public TPERSON()
        {
            OnCreated();
        }

    
        /// <summary>
        /// There are no comments for ID in the schema.
        /// </summary>
        public virtual int ID
        {
            get;
            set;
        }

    
        /// <summary>
        /// There are no comments for FIRSTNAME in the schema.
        /// </summary>
        public virtual string FIRSTNAME
        {
            get;
            set;
        }

    
        /// <summary>
        /// There are no comments for LASTNAME in the schema.
        /// </summary>
        public virtual string LASTNAME
        {
            get;
            set;
        }
    }

}
Test.TPERSON.hbm.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping schema="TEST" namespace="Test.Models" xmlns="urn:nhibernate-mapping-2.2">
  <class name="TPERSON" table="T_PERSON" schema="TEST">
    <id name="ID" type="Int32">
      <column name="ID" not-null="true" precision="9" scale="0" sql-type="NUMBER" />
      <generator class="assigned" />
    </id>
    <property name="FIRSTNAME" type="String">
      <column name="FIRST_NAME" not-null="false" length="20" sql-type="VARCHAR2" />
    </property>
    <property name="LASTNAME" type="String">
      <column name="LAST_NAME" not-null="false" length="50" sql-type="VARCHAR2" />
    </property>
  </class>
</hibernate-mapping>
Test.TPERSON.LoquaciousMapping.cs

Code: Select all

//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using NHibernate Loquacious Mapping template.
// Code is generated on: 1/26/2016 11:10:00 PM
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using NHibernate;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;

namespace Test.Models
{
    /// <summary>
    /// There are no comments for TPERSONMap in the schema.
    /// </summary>
    public partial class TPERSONMap : ClassMapping<TPERSON>
    {
        /// <summary>
        /// There are no comments for TPERSONMap constructor in the schema.
        /// </summary>
        public TPERSONMap()
        {
              Schema(@"TEST");
              Table(@"T_PERSON");
              Lazy(true);
              Id(x => x.ID, id => {
                id.Column(@"ID");
                id.Access(Accessor.Property);
                id.Type(NHibernateUtil.Int32);
                id.Generator(Generators.Assigned);
              });
              Property(x => x.FIRSTNAME, pm => {
    
                    pm.Column(    
                                        c => {
                                        c.Name(@"FIRST_NAME");
                                        c.SqlType(@"VARCHAR2");
                                        c.Length(20);
                                        }

                    );
                    pm.Access(Accessor.Property);
                    pm.Type(NHibernateUtil.String);
                    pm.Generated(PropertyGeneration.Never);
                    pm.Length(20);
                    });
              Property(x => x.LASTNAME, pm => {
    
                    pm.Column(    
                                        c => {
                                        c.Name(@"LAST_NAME");
                                        c.SqlType(@"VARCHAR2");
                                        c.Length(50);
                                        }

                    );
                    pm.Access(Accessor.Property);
                    pm.Type(NHibernateUtil.String);
                    pm.Generated(PropertyGeneration.Never);
                    pm.Length(50);
                    });
              ExtendMapping();
        }

        #region Partial Methods

        partial void ExtendMapping();

        #endregion
    }

}


Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Class, Method and Property names are always in upper case

Post by Shalex » Wed 27 Jan 2016 12:11

ahamBrahmasmi wrote:The database is oracle 12c. Below is the DDL of test table

Code: Select all

create table T_Person (
  Id number(9) not null,
  First_Name VARCHAR(20),
  Last_Name VARCHAR(50),
  primary key (Id)
)
Upper case is a default case in Oracle, so your script actually creates the following table:

Code: Select all

create table T_PERSON (
  ID number(9) not null,
  FIRST_NAME VARCHAR(20),
  LAST_NAME VARCHAR(50),
  primary key (ID)
)
You should quote the names to preserve the case:

Code: Select all

create table "T_Person" (
  "Id" number(9) not null,
  "First_Name" VARCHAR(20),
  "Last_Name" VARCHAR(50),
  primary key ("Id")
)
After the table with quoted names is created in your database, readd the new "T_Person" table to the model and check the workability of naming rules.

ahamBrahmasmi
Posts: 5
Joined: Sat 23 Jan 2016 08:09

Re: Class, Method and Property names are always in upper case

Post by ahamBrahmasmi » Thu 28 Jan 2016 00:53

Yes..after the table with quoted names is created in the database, i was able to change the naming rules of model and property and it works fine. I tried with all the case options under Model Name settings and it generated as per the configuration.

So it looks like only the case option "FirstLetterUpperCase" in Model Name settings is not working if the table is not created with quoted names then.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Class, Method and Property names are always in upper case

Post by Shalex » Thu 28 Jan 2016 08:15

ahamBrahmasmi wrote:So it looks like only the case option "FirstLetterUpperCase" in Model Name settings is not working if the table is not created with quoted names then.
Refer to http://www.devart.com/entitydeveloper/e ... eloper.chm > ORM Support > Entity Framework > Customizing Model Properties > Synchronization > Model Naming:
FirstLetterUppercase
The name of an entity begins with a capital letter, case of other letters will not be changed.

ahamBrahmasmi
Posts: 5
Joined: Sat 23 Jan 2016 08:09

Re: Class, Method and Property names are always in upper case

Post by ahamBrahmasmi » Thu 28 Jan 2016 14:13

Oops! :oops:

Thanks for pointing that out Shalex. Guess I'll rest my case :)

Post Reply