private void MapEmpresas(DbModelBuilder modelBuilder) { EntityTypeConfiguration <Empresa> tabla = modelBuilder.Entity <Empresa>() .ToTable("Empresas") .HasKey(e => e.EmpresaID); tabla.Property(e => e.EmpresaID) .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); tabla.Property(e => e.Nombre).HasMaxLength(100).IsRequired(); tabla.Property(e => e.Direccion).HasMaxLength(500).IsRequired(); tabla.Property(e => e.CodigoPostal).HasMaxLength(10).IsRequired(); tabla.Property(e => e.Localidad).HasMaxLength(100).IsRequired(); tabla.Property(e => e.Provincia).HasMaxLength(100).IsRequired(); tabla.Property(e => e.Descripcion).HasMaxLength(500).IsRequired(); tabla.Property(e => e.Telefono).HasMaxLength(20).IsRequired(); tabla.Property(e => e.Email).HasMaxLength(250).IsRequired(); tabla.Property(e => e.Web).HasMaxLength(500).IsRequired(); tabla.Property(e => e.Facebook).HasMaxLength(500).IsRequired(); tabla.Property(e => e.Twitter).HasMaxLength(500).IsRequired(); tabla.Property(e => e.Tags).HasMaxLength(500).IsRequired(); tabla.HasRequired(e => e.Aplicacion) .WithMany(apl => apl.Empresas) .HasForeignKey(e => e.AplicacionID); tabla.HasOptional(e => e.Logotipo) .WithMany() .HasForeignKey(e => e.LogotipoDocumentoID); tabla.HasOptional(e => e.Banner) .WithMany() .HasForeignKey(e => e.BannerDocumentoID); }
public BankBuilder(EntityTypeConfiguration <Bank> builder) { builder.Property(b => b.Name).HasMaxLength(50).IsRequired(); builder.Property(b => b.Address).HasMaxLength(4000); builder.HasOptional(p => p.Country).WithMany(w => w.Banks).HasForeignKey(p => p.CountryId); builder.HasOptional(p => p.City).WithMany(w => w.Banks).HasForeignKey(p => p.CityId); builder.Property(b => b.Account).HasMaxLength(20).IsRequired(); }
public ProductionEquipmentBuilder(EntityTypeConfiguration <ProductionEquipment> builder) { builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.Property(b => b.Description).HasMaxLength(4000); builder.HasOptional(a => a.Language).WithMany(b => b.ProductionEquipments).HasForeignKey(a => a.LanguageId); builder.HasOptional(a => a.Company).WithMany(b => b.ProductionEquipments).HasForeignKey(a => a.CompanyId); builder.HasOptional(a => a.Facility).WithMany(b => b.ProductionEquipments).HasForeignKey(a => a.FacilityId); }
public MaterialInputBuilder(EntityTypeConfiguration <MaterialInput> builder) { builder.HasOptional(a => a.Order).WithMany(b => b.MaterialInputs).HasForeignKey(a => a.OrderId); builder.HasOptional(a => a.OrderType).WithMany(b => b.MaterialInputs).HasForeignKey(a => a.OrderTypeId); builder.HasRequired(a => a.Material).WithMany(b => b.MaterialInputs).HasForeignKey(a => a.MaterialId); builder.HasRequired(a => a.Supplier).WithMany(b => b.MaterialInputs).HasForeignKey(a => a.SupplierId); builder.HasRequired(a => a.StockLocation).WithMany(b => b.MaterialInputs).HasForeignKey(a => a.StockLocationId); }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { var contactConfiguration = new EntityTypeConfiguration <Contact>(); contactConfiguration.HasOptional(c => c.Secretary).WithOptionalPrincipal(); contactConfiguration.HasOptional(c => c.Assistant).WithOptionalPrincipal(); modelBuilder.Configurations.Add(contactConfiguration); }
public OrderItemBuilder(EntityTypeConfiguration <OrderItem> entity) { entity.HasOptional(e => e.Customer).WithMany(m => m.OrderItems).HasForeignKey(f => f.CustomerId); entity.HasOptional(e => e.Product).WithMany(m => m.OrderItems).HasForeignKey(f => f.ProductId); entity.HasOptional(e => e.Order).WithMany(m => m.OrderItems).HasForeignKey(f => f.OrderId); }
public StockLocationBuilder(EntityTypeConfiguration <StockLocation> builder) { builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.Property(b => b.Warehouse).HasMaxLength(100).IsRequired(); builder.Property(b => b.Description).HasMaxLength(4000); builder.HasOptional(a => a.Company).WithMany(b => b.StockLocations).HasForeignKey(a => a.CompanyId); builder.HasOptional(a => a.Facility).WithMany(b => b.StockLocations).HasForeignKey(a => a.FacilityId); }
public TeacherBuilder(EntityTypeConfiguration <Teacher> entity) { entity.Property(e => e.TeacherName).IsRequired().HasMaxLength(200); entity.Property(e => e.Address).IsRequired().HasMaxLength(200); entity.Property(e => e.Email).IsRequired().HasMaxLength(200); entity.Property(e => e.ContactNo).IsRequired().HasMaxLength(200); entity.HasOptional(e => e.Designation).WithMany(c => c.Teachers).HasForeignKey(p => p.DesignationId); entity.HasOptional(e => e.Department).WithMany(c => c.Teachers).HasForeignKey(p => p.DeptId); }
public CourseBuilder(EntityTypeConfiguration <Course> entity) { entity.Property(e => e.CourseName).IsRequired().HasMaxLength(100); entity.Property(e => e.CourseCode).IsRequired().HasMaxLength(100); entity.Property(e => e.Credit).IsRequired(); entity.Property(e => e.Description).IsRequired().HasMaxLength(100); entity.HasOptional(e => e.Teacher).WithMany(c => c.Courses).HasForeignKey(p => p.TeacherId); entity.HasOptional(e => e.Department).WithMany(c => c.Courses).HasForeignKey(p => p.DeptId); entity.HasOptional(e => e.Semester).WithMany(c => c.Courses).HasForeignKey(p => p.SemesterId); }
public BranchBuilder(EntityTypeConfiguration <Branch> entity) { entity.HasKey(p => p.Id); entity.HasOptional(p => p.Company).WithMany(w => w.Branches).HasForeignKey(p => p.CompanyId); entity.HasOptional(p => p.Country).WithMany(w => w.Branches).HasForeignKey(p => p.CountryId); entity.HasOptional(p => p.City).WithMany(w => w.Branches).HasForeignKey(p => p.CityId); entity.HasOptional(p => p.County).WithMany(w => w.Branches).HasForeignKey(p => p.CountyId); }
public OrderBuilder(EntityTypeConfiguration <Order> builder) { builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.HasOptional(a => a.Company).WithMany(b => b.Orders).HasForeignKey(a => a.CompanyId); builder.HasOptional(a => a.Facility).WithMany(b => b.Orders).HasForeignKey(a => a.FacilityId); builder.HasRequired(a => a.BusinessArea).WithMany(b => b.Orders).HasForeignKey(a => a.BusinessAreaId); builder.HasRequired(a => a.PurchasingDepartment).WithMany(b => b.Orders).HasForeignKey(a => a.PurchasingDepartmentId); builder.HasRequired(a => a.OrderType).WithMany(b => b.Orders).HasForeignKey(a => a.OrderTypeId); builder.HasRequired(a => a.Supplier).WithMany(b => b.Orders).HasForeignKey(a => a.SupplierId); }
public SupplierBuilder(EntityTypeConfiguration <Supplier> builder) { builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.HasOptional(a => a.Company).WithMany(b => b.Suppliers).HasForeignKey(a => a.CompanyId); builder.HasOptional(a => a.BusinessArea).WithMany(b => b.Suppliers).HasForeignKey(a => a.BusinessAreaId); builder.HasRequired(a => a.Sector).WithMany(b => b.Suppliers).HasForeignKey(a => a.SectorId); builder.HasOptional(a => a.Country).WithMany(b => b.Suppliers).HasForeignKey(a => a.CountryId); builder.HasOptional(a => a.City).WithMany(b => b.Suppliers).HasForeignKey(a => a.CityId); }
public CriterionBuilder(EntityTypeConfiguration <Criterion> builder) { builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.Property(b => b.Description).HasMaxLength(4000); builder.HasRequired(a => a.Certificate).WithMany(b => b.Criterions).HasForeignKey(a => a.CertificateId); builder.HasOptional(a => a.Unit).WithMany(b => b.Criterions).HasForeignKey(a => a.UnitId); builder.HasOptional(a => a.ProductionEquipment).WithMany(b => b.Criterions).HasForeignKey(a => a.ProductionEquipmentId); builder.HasOptional(a => a.SystemUser).WithMany(b => b.Criterions).HasForeignKey(a => a.SystemUserId); builder.HasOptional(a => a.UserGroup).WithMany(b => b.Criterions).HasForeignKey(a => a.UserGroupId); }
public SupplierBuilder(EntityTypeConfiguration <Supplier> builder) { builder.Property(b => b.FirstName).HasMaxLength(50).IsRequired(); builder.Property(b => b.LastName).HasMaxLength(50).IsRequired(); builder.Property(b => b.Address).HasMaxLength(4000); builder.HasOptional(p => p.Country).WithMany(w => w.Suppliers).HasForeignKey(p => p.CountryId); builder.HasOptional(p => p.City).WithMany(w => w.Suppliers).HasForeignKey(p => p.CityId); builder.Property(b => b.MobilePhone).HasMaxLength(20).IsRequired(); builder.Property(b => b.Email).HasMaxLength(100); }
public CompanyBuilder(EntityTypeConfiguration <Company> builder) { builder.Property(a => a.CompanyLocation).HasMaxLength(100); builder.Property(a => a.Location).HasMaxLength(100); builder.Property(a => a.Owner).HasMaxLength(100); builder.Property(a => a.CompanyNumber).HasMaxLength(20); builder.Property(a => a.Telephone).HasMaxLength(20); builder.Property(a => a.Fax).HasMaxLength(20); builder.Property(a => a.Website).HasMaxLength(50); builder.Property(a => a.ImkbCode).HasMaxLength(50); builder.Property(a => a.NaceCode).HasMaxLength(50); builder.Property(a => a.DeliveryAddress).HasMaxLength(500); builder.Property(a => a.DeliveryPostalCode).HasMaxLength(50); builder.Property(a => a.InvoiceAddress).HasMaxLength(500); builder.Property(a => a.InvoicePostalCode).HasMaxLength(50); builder.Property(a => a.Description).HasMaxLength(4000); builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.HasOptional(a => a.MainCompany).WithMany(b => b.ChildCompanies).HasForeignKey(a => a.MainCompanyId); builder.HasOptional(a => a.CompanyType).WithMany(b => b.Companies).HasForeignKey(a => a.CompanyTypeId); builder.HasOptional(a => a.Sector).WithMany(b => b.Companies).HasForeignKey(a => a.SectorId); builder.HasOptional(a => a.InvoiceCity).WithMany(b => b.InvoiceCompanies).HasForeignKey(a => a.InvoiceCityId); builder.HasOptional(a => a.InvoiceRegion).WithMany(b => b.InvoiceCompanies).HasForeignKey(a => a.InvoiceRegionId); builder.HasOptional(a => a.InvoiceCountry).WithMany(b => b.InvoiceCompanies).HasForeignKey(a => a.InvoiceCountryId); builder.HasOptional(a => a.DeliveryCity).WithMany(b => b.DeliveryCompanies).HasForeignKey(a => a.DeliveryCityId); builder.HasOptional(a => a.DeliveryRegion).WithMany(b => b.DeliveryCompanies).HasForeignKey(a => a.DeliveryRegionId); builder.HasOptional(a => a.DeliveryCountry).WithMany(b => b.DeliveryCompanies).HasForeignKey(a => a.DeliveryCountryId); }
public OpportunityBuilder(EntityTypeConfiguration <Opportunity> builder) { builder.Property(b => b.Owner).HasMaxLength(100); builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.HasRequired(a => a.Company).WithMany(b => b.Opportunities).HasForeignKey(a => a.CompanyId); builder.Property(b => b.NextStep).HasMaxLength(100); builder.HasOptional(b => b.LeadSource).WithMany(a => a.Opportunities).HasForeignKey(b => b.LeadSourceId); builder.HasOptional(b => b.Contact).WithMany(a => a.Opportunities).HasForeignKey(b => b.ContactId); builder.HasOptional(b => b.CampaignSource).WithMany(a => a.Opportunities).HasForeignKey(b => b.CampaignSourceId); builder.Property(b => b.Description).HasMaxLength(4000); }
public EmployeeBuilder(EntityTypeConfiguration <Employee> entity) { entity.HasKey(p => p.Id); entity.Property(p => p.FirstName).IsRequired().HasMaxLength(100); entity.Property(p => p.LastName).IsRequired().HasMaxLength(100); entity.Property(p => p.UserName).IsRequired().HasMaxLength(200); entity.Property(p => p.Position).IsRequired().HasMaxLength(200); entity.HasMany(p => p.Departments).WithMany(w => w.Employees); entity.HasOptional(p => p.Company).WithMany(w => w.Employees).HasForeignKey(p => p.CompanyId); // bunu da silmek gerekicek. entity.HasOptional(p => p.Branch).WithMany(w => w.Employees).HasForeignKey(p => p.BranchId); }
public static EntityTypeConfiguration <InventoryInsHeader> Map() { var map = new EntityTypeConfiguration <InventoryInsHeader>(); map.HasRequired(I => I.Inv).WithMany(C => C.InventoryInsHeaders).HasForeignKey(p => p.InventoryId); map.HasRequired(I => I.type).WithMany(C => C.InventoryInsHeaders).HasForeignKey(p => p.TypeId); map.HasOptional(C => C.DeletedUser).WithMany(U => U.DeletedInventoryInsHeader).HasForeignKey(I => I.AcceptedByUserId); map.HasOptional(C => C.DeletedUser).WithMany(U => U.DeletedInventoryInsHeader).HasForeignKey(I => I.DeletedByUserId); map.HasRequired(C => C.CreatedUser).WithMany(U => U.CreatedInventoryInsHeader).HasForeignKey(I => I.CreatedByUserId).WillCascadeOnDelete(false); map.HasOptional(C => C.ChangedUser).WithMany(U => U.ChangedInventoryInsHeader).HasForeignKey(I => I.ChangedByUserId); return(map); }
public static EntityTypeConfiguration <ProductCategory> Map() { var map = new EntityTypeConfiguration <ProductCategory>(); map.Property(P => P.Title).HasMaxLength(100).IsRequired(); map.Property(P => P.Description).HasMaxLength(1000); map.HasRequired(P => P.Inventories).WithMany(C => C.ProductCategories).HasForeignKey(p => p.InventoryId).WillCascadeOnDelete(false); map.HasOptional(C => C.DeletedUser).WithMany(U => U.DeletedProductCategory).HasForeignKey(I => I.DeletedByUserId); map.HasRequired(C => C.CreatedUser).WithMany(U => U.CreatedProductCategory).HasForeignKey(I => I.CreatedByUserId).WillCascadeOnDelete(false); map.HasOptional(C => C.ChangedUser).WithMany(U => U.ChangedProductCategory).HasForeignKey(I => I.ChangedByUserId); return(map); }
internal static void Define(EntityTypeConfiguration<Domain.Transaction> config) { config.HasOptional(p => p.CreditedUser) .WithMany(r => r.Credits) .HasForeignKey(fk => fk.CreditedUserId); config.HasOptional(p => p.DebitedUser) .WithMany(r => r.Debits) .HasForeignKey(fk => fk.DebitedUserId); config.Property(p => p.Amount).HasPrecision(19, 4); }
public static EntityTypeConfiguration <Corporation> Map() { var map = new EntityTypeConfiguration <Corporation>(); map.Property(C => C.Title).HasMaxLength(200).IsRequired(); map.Property(C => C.Description).HasMaxLength(1000); map.Property(C => C.Address).HasMaxLength(1000); map.HasOptional(C => C.DeletedUser).WithMany(U => U.DeletedCorporition).HasForeignKey(I => I.DeletedByUserId); map.HasRequired(C => C.CreatedUser).WithMany(U => U.CreatedCorporition).HasForeignKey(I => I.CreatedByUserId).WillCascadeOnDelete(false); map.HasOptional(C => C.ChangedUser).WithMany(U => U.ChangedCorporition).HasForeignKey(I => I.ChangedByUserId); return(map); }
public void BuildInvitation(EntityTypeConfiguration <Invitation> invitationBuilder) { invitationBuilder .HasOptional(i => i.InvitedUser) .WithMany(u => u.Invitations) .HasForeignKey(i => i.InvitedUserId); invitationBuilder .HasOptional(i => i.Team) .WithMany(t => t.Invitatins) .HasForeignKey(i => i.TeamId); }
public static EntityTypeConfiguration <InventoryOutsType> Map() { var map = new EntityTypeConfiguration <InventoryOutsType>(); map.Property(I => I.Title).HasMaxLength(200).IsRequired(); map.Property(I => I.Description).HasMaxLength(1000); map.HasOptional(I => I.DeletedUser).WithMany(U => U.DeletedInventoryOutsType).HasForeignKey(I => I.DeletedByUserId); map.HasRequired(I => I.CreatedUser).WithMany(U => U.CreatedInventoryOutsType).HasForeignKey(I => I.CreatedByUserId).WillCascadeOnDelete(false); map.HasOptional(I => I.ChangedUser).WithMany(U => U.ChangedInventoryOutsType).HasForeignKey(I => I.ChangedByUserId); return(map); }
internal static void OnModelCreating(EntityTypeConfiguration <Log> entityTypeConfiguration) { entityTypeConfiguration.HasOptional(i => i.Message) .WithMany() .HasForeignKey(i => i.MessageID); entityTypeConfiguration.HasOptional(i => i.Packet) .WithMany() .HasForeignKey(i => i.PacketID); entityTypeConfiguration.HasOptional(i => i.Module) .WithMany() .HasForeignKey(i => i.ModuleID); }
public static EntityTypeConfiguration <Inventory> Map() { var map = new EntityTypeConfiguration <Inventory>(); map.Property(I => I.Title).HasMaxLength(100).IsRequired(); map.Property(I => I.Description).HasMaxLength(1000); map.Property(I => I.Address).HasMaxLength(1000); map.HasRequired(I => I.corporation).WithMany(C => C.Inventories) .Map(_map => _map.MapKey("CorporationId")); map.HasOptional(C => C.DeletedUser).WithMany(U => U.DeletedInventory).HasForeignKey(I => I.DeletedByUserId); map.HasRequired(C => C.CreatedUser).WithMany(U => U.CreatedInventory).HasForeignKey(I => I.CreatedByUserId).WillCascadeOnDelete(false); map.HasOptional(C => C.ChangedUser).WithMany(U => U.ChangedInventory).HasForeignKey(I => I.ChangedByUserId); return(map); }
public ActivityBuilder(EntityTypeConfiguration <Activity> builder) { builder.Property(b => b.Subject).HasMaxLength(100).IsRequired(); builder.HasOptional(a => a.Contact).WithMany(b => b.Activities).HasForeignKey(a => a.ContactId); builder.Property(b => b.CompanyName).HasMaxLength(100).IsRequired(); builder.HasOptional(a => a.Company).WithMany(b => b.Activities).HasForeignKey(a => a.CompanyId); builder.Property(b => b.OpportunityName).HasMaxLength(100).IsRequired(); builder.Property(b => b.OpportunityCloseDate).IsRequired(); builder.Property(b => b.OpportunityStage).IsRequired(); builder.Property(b => b.OpportunityType).IsRequired(); builder.Property(b => b.CampaignName).HasMaxLength(100).IsRequired(); builder.HasOptional(a => a.Opportunity).WithMany(b => b.Activities).HasForeignKey(a => a.OpportunityId); builder.HasOptional(a => a.Campaign).WithMany(b => b.Activities).HasForeignKey(a => a.CampaignId); }
public static EntityTypeConfiguration <ProductUnit> Map() { var map = new EntityTypeConfiguration <ProductUnit>(); map.Property(C => C.Title).HasMaxLength(200).IsRequired(); map.Property(C => C.Description).HasMaxLength(1000); map.HasOptional(C => C.DeletedUser).WithMany(U => U.DeletedProductUnit).HasForeignKey(I => I.DeletedByUserId); map.HasRequired(C => C.CreatedUser).WithMany(U => U.CreatedProductUnit).HasForeignKey(I => I.CreatedByUserId).WillCascadeOnDelete(false); map.HasOptional(C => C.ChangedUser).WithMany(U => U.ChangedProductUnit).HasForeignKey(I => I.ChangedByUserId); map.Property(U => U.Title).HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("Ix_Title_Unique") { IsUnique = true })); return(map); }
static void ConfigureCity(EntityTypeConfiguration <City> entity) { entity.Property(p => p.Name) .IsUnicode(false) .HasMaxLength(100) .IsConcurrencyToken(); entity.HasIndex(e => e.Name); entity.Property(e => e.Name).IsConcurrencyToken(); entity .HasOptional(c => c.Province) .WithMany(p => p.Cities); entity .HasOptional(c => c.Country); entity.MapToStoredProcedures(); }
public TimeSpendingBuilder(EntityTypeConfiguration <TimeSpending> builder) { builder.Property(b => b.Name).HasMaxLength(100).IsRequired(); builder.HasRequired(a => a.Project).WithMany(b => b.TimeSpendings).HasForeignKey(a => a.ProjectId); builder.HasOptional(a => a.WorkItem).WithMany(b => b.TimeSpendings).HasForeignKey(a => a.WorkItemId); builder.Property(b => b.Worker).HasMaxLength(100).IsRequired(); }
public PostBuilder(EntityTypeConfiguration <Post> entity) { entity.HasKey(e => e.Id); entity.Property(p => p.Title).IsRequired().HasMaxLength(100); entity.Property(p => p.Description).IsRequired().HasMaxLength(5000); entity.HasOptional(p => p.Category).WithMany(m => m.Posts).HasForeignKey(f => f.CategoryId); }
public CountyBuilder(EntityTypeConfiguration <County> entity) { entity.HasKey(p => p.Id); entity.Property(p => p.Name).IsRequired().HasMaxLength(200); entity.HasOptional(p => p.City).WithMany(w => w.Counties).HasForeignKey(p => p.CityId); }