This question is locked. New answers and comments are not allowed.
I have these two classes: Company and Employee. A company has many employees.
In my database, I have an employee associated to company (id #2). But when I do this:
the companyitem shown a list of zero employee.
Why is that? And also, why isn't the employee list get created as a property in the class generated?
| public partial class Company |
| { |
| //The 'no-args' constructor required by OpenAccess. |
| public Company() |
| { |
| } |
| [Telerik.OpenAccess.FieldAlias("companyID")] |
| public int ID |
| { |
| get { return companyID; } |
| set { this.companyID = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("address")] |
| public string Address |
| { |
| get { return address; } |
| set { this.address = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("email")] |
| public string Email |
| { |
| get { return email; } |
| set { this.email = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("fax")] |
| public string Fax |
| { |
| get { return fax; } |
| set { this.fax = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("logo")] |
| public string Logo |
| { |
| get { return logo; } |
| set { this.logo = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("phone")] |
| public string Phone |
| { |
| get { return phone; } |
| set { this.phone = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("postalAddress")] |
| public string PostalAddress |
| { |
| get { return postalAddress; } |
| set { this.postalAddress = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("subDomain")] |
| public string SubDomain |
| { |
| get { return subDomain; } |
| set { this.subDomain = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("teleMallID")] |
| public int? TeleMallID |
| { |
| get { return teleMallID; } |
| set { this.teleMallID = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("webSite")] |
| public string WebSite |
| { |
| get { return webSite; } |
| set { this.webSite = value; } |
| } |
| } |
| // Generated by Telerik OpenAccess |
| // Used template: c:\program files\telerik\openaccess orm\sdk\IDEIntegrations\templates\PCClassGeneration\cs\templates\classgen\class\partialdesignerdefault.vm |
| [Telerik.OpenAccess.Persistent(IdentityField="companyID")] |
| public partial class Company |
| { |
| private int companyID; // pk |
| private string address; |
| private string email; |
| private string fax; |
| private string logo; |
| private string phone; |
| private string postalAddress; |
| private string subDomain; |
| private int? teleMallID; |
| private string webSite; |
| private IList<EPYEmployee> employeeCol = new List<EPYEmployee>(); // inverse EPYEmployee.company |
| } |
| public partial class EPYEmployee |
| { |
| //The 'no-args' constructor required by OpenAccess. |
| public EPYEmployee() |
| { |
| } |
| [Telerik.OpenAccess.FieldAlias("id")] |
| public int Id |
| { |
| get { return id; } |
| set { this.id = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("dAMProfileImageFK")] |
| public int? DAMProfileImageFK |
| { |
| get { return dAMProfileImageFK; } |
| set { this.dAMProfileImageFK = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("department")] |
| public string Department |
| { |
| get { return department; } |
| set { this.department = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("email")] |
| public string Email |
| { |
| get { return email; } |
| set { this.email = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("firstName")] |
| public string FirstName |
| { |
| get { return firstName; } |
| set { this.firstName = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("lastName")] |
| public string LastName |
| { |
| get { return lastName; } |
| set { this.lastName = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("mobile")] |
| public string Mobile |
| { |
| get { return mobile; } |
| set { this.mobile = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("password")] |
| public string Password |
| { |
| get { return password; } |
| set { this.password = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("phone")] |
| public string Phone |
| { |
| get { return phone; } |
| set { this.phone = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("title")] |
| public string Title |
| { |
| get { return title; } |
| set { this.title = value; } |
| } |
| } |
| // Generated by Telerik OpenAccess |
| // Used template: c:\program files\telerik\openaccess orm\sdk\IDEIntegrations\templates\PCClassGeneration\cs\templates\classgen\class\partialdesignerdefault.vm |
| [Telerik.OpenAccess.Persistent(IdentityField="id")] |
| public partial class EPYEmployee |
| { |
| private int id; // pk |
| private int? dAMProfileImageFK; |
| private string department; |
| private string email; |
| private string firstName; |
| private string lastName; |
| private string mobile; |
| private string password; |
| private string phone; |
| private string title; |
| private Company company; // inverse Company.employeeCol |
| } |
In my database, I have an employee associated to company (id #2). But when I do this:
| //retrieve a row |
| Company companyitem = CompanyBO.GetCompanyById(2); |
the companyitem shown a list of zero employee.
Why is that? And also, why isn't the employee list get created as a property in the class generated?