c# - Error when using Update-Database command MVC 4 -


I have created a seed method and it has failed to replicate my 'ticket' table, fixing the other two tables. has gone.

There is an error displayed in the Package Manager console:

  The value tag can not be included in the column 'ticketIt', the table 'OnlineTystemSystemSearch .dbo.Tickets'; Column faucets do not allow INSERT fails   

This is my seed method for 'ticket' table which will not be populated:

  var ticket = New list & lt; Ticket & gt; {New ticket} {employee = employee} singles (s = & gt; s.Surname == "Alexander"). Employee id, customerID = customer Single (C => Names named == "Marsden"). Customer ID, Summary = "Broke laptop screen", Start date = DateTime.Presse ("04/05/2012"), Payment = DateTime Purse ("10/05/2012"), hardwareDeliveWid = true, condition = position Open, priority = priority. Hi}, new ticket {employee / employee Single (S = & gt; S Nameame == "Marshall"). Employee id, customer id = customer Single (C = & gt; c.name == "Copper"). Customer ID, summary = "keyboard does not work", StartDate = DateTime.Parse ("09/07/2012"), DueDate = DateTime.Parse ("12/07/2012"), HardwareDelivered = true, Status = Status. Open, Priority = Priority High}}; Foreign Tickets (ticket Tickets in ticket) {var ticket in database = reference. Tickets.Where (s => s.Employee.EmployeeID == T. EmpireID & amp; customer.CustomerID == T. Customer ID) .ingleOrDefault (); If (ticketInDataBase == zero) {ref. Tickets.Add (t); }} Context.SaveChanges ();   

Here is the ticket model:

  public class tickets {public int ticket id {get; Set; } Received Public Interactive ID { Set; } Receive public full customer ID { Set; } Public String Summary {get; Set; } Public DataTime StartDate {Received; Set; } Public Date Scheduling {Receive; Set; } Public Boolean hardware delays {get; Set; } Public status? Status {receive; Set; } Public priority? Priority {Received; Set; } Public Virtual Employee Employee {Received; Set; } Public Virtual Customer Client {Received; Set; }    

I automatically migrate:

 < Code> Internal sealed class configuration: DBMegration configuration & lt; NetCollab.Web.Data.DataContext & gt; {Public Configuration () {AutomaticMgrrans Enabled = True; AutomaticMigrationDataLossAllowed = True; ContextKey = "NetCollab.Web.Data.DataContext"; } Secure Override Zero Seed (NetColb.V.Data.DataContent Reference) {// This method will be called after migrating to the latest version}}   

AutomaticMandDalosAlpact = true; Resolve that problem or you can remove the table and repeat the migration.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -