I have a C# class defined below. My Table structure is the same IID is Primary Key Identity(1,1), but when I bulk copy multiple new items I get an error due to Primary Key Violation. What values am I supposed to have for each value when adding new entries?
Code for BulkCopy:
public void AddVaults(List<VaultModel> models)
{
Database.BulkCopy<VaultModel>("dbo.Vault", models);
}
Class:
public class VaultModel
{
public int IID { get; set; }
public int System_ID { get; set; }
public string SystemName { get; set; }
public int Environ_ID { get; set; }
public string EnvironName { get; set; }
public int ValueDesc_ID { get; set; }
public string ValueDesc { get; set; }
public string ValueAbbrev { get; set; }
public string Value { get; set; }
public DateTime Eff_Date { get; set; }
public DateTime? Exp_Date { get; set; }
public string LastUsername { get; set; }
public DateTime? LastDateTime { get; set; }
}
Describe the question
I have a C# class defined below. My Table structure is the same IID is Primary Key Identity(1,1), but when I bulk copy multiple new items I get an error due to Primary Key Violation. What values am I supposed to have for each value when adding new entries?
Code for BulkCopy:
Class:
Steps to reproduce (if applicable)