using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.Core.Objects; using System.Linq; using System.Web; using System.Runtime.Serialization; using Microsoft.AspNet.Identity.EntityFramework; using Newtonsoft.Json; using Resources; using Weee.DAL; namespace Weee.Models { [Table("NormalCompany")] public class NormalCompany : Company, IValidatableObject { public NormalCompany() : base() { Fabs = new HashSet(); Products = new HashSet(); ReceiveRequests = new HashSet(); SupplierList = new HashSet(); HasLCAs = new HashSet(); } [InverseProperty("Company")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection SupplierList { get; set; } [InverseProperty("OwnerCompany")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection Fabs { get; set; } [InverseProperty("OwnerCompany")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection Products { get; set; } [InverseProperty("ReceiveBy")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection ReceiveRequests { get; set; } [InverseProperty("Owner")] [JsonIgnore] [IgnoreDataMember] public virtual ICollection HasLCAs { get; set; } [NotMapped] [JsonIgnore] [IgnoreDataMember] public ICollection MyProductLCAs { get { return HasLCAs.Where(x => ObjectContext.GetObjectType(x.GetType()) == typeof(ProductLCA)).Cast().ToList(); } } } }