Incorrect generated names

2 posts, 0 answers
  1. Andrii
    Andrii avatar
    13 posts
    Member since:
    Nov 2011

    Posted 23 May 2013 Link to this post

    Hi! We have troubles with names of generated properties, for example:
    Person have 2 addresses: home and current. Table Person have two columns that have relations with Address table 
    Hi! We have troubles with generated names of properties, for example:
    Person have 2 addresses: home and current. Table Person have two columns that have relations with Address table 
    But generated by OA properties in Person have names like:
    private Address _address;
            public virtual Address Address
            {
                get
                {
                    return this._address;
                }
                set
                {
                    this._address = value;
                }
            }
     
    private Address _address1;
            public virtual Address Address1
            { ...}
    In table columns with foreign keys have names like HomeAddressId, CurrentAddressId
    How to generate names for these properties  like HomeAddress and CurrentAddress?
  2. Yordan
    Admin
    Yordan avatar
    39 posts

    Posted 24 May 2013 Link to this post

    Hello Andriy,

    To rename the generated navigational properties just open the .rlinq file in the designer. Then select the navigational properties of type Person and hit F4 so the properties window is opened. In the properties window change the name to the desired value.The code that is generated after that will be similar to the following:
    private Address _address;
    public virtual Address CurrentAddress
    {
        get
        {
            return this._address;
        }
        set
        {
            this._address = value;
        }
    }
     
    private Address _address1;
    public virtual Address HomeAddress
    {
        get
        {
            return this._address1;
        }
        set
        {
            this._address1 = value;
        }
    }

    More about navigational properties can be found in this article.

    Find the attached picture as a guide where the change have to be made. If you have any more questions about the subject please get back to us.
     
    Regards,
    Yordan
    Telerik
    OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
  3. DevCraft banner
Back to Top