Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why Entity Framework mapped a table named "People" as an entity named "Person" inside my .edmx file

I am working on an asp.net mvc-4 web application and i am using Entity Framework 5.0 . now i have mapped my sql server 2008 tables using entity framework with database first approach. but i got this strange issue after completing the mapping, now inside my database i have a table named ""People as follow:-

enter image description here

but on the generated edmx file the table was renamed as "Person" , here is how the entity looks like inside my edmx file :-

enter image description here

here is the generated model class:-

    using System;
    using System.Collections.Generic;

    public partial class Person
    {
        public long CIID { get; set; }
        public string ATTRIBUTE_1202 { get; set; }

        public virtual BaseElement BaseElement { get; set; }
        public virtual Requester Requester { get; set; }
        public virtual Technician Technician { get; set; }
    }
}

so can anyone adivce why the "People" table is presented as an Entity named "Person" inside the .edmx file ?

like image 906
john Gu Avatar asked Nov 25 '15 01:11

john Gu


1 Answers

I think, you checked option "Pluralize or aingularize generated object names". So People means many, Person means single.

enter image description here

Usually, it just adds or removes s and es in the end, but in some cases it does more complex replacements.

like image 173
Backs Avatar answered Sep 21 '22 23:09

Backs