Public partial class person { [Key] While [StringLength (64)] Public string name {get; set; } }
In the database table "person" is only a string field, how do I turn the format of the string array, can make the final use AddRange () batch of new to this list "people"?
Gestalt fills up the words is this: Database.. AddRange (___________________); The database library. SaveChanges ();
CodePudding user response:
ListForeach (var s in array) List. The Add (new person () {} name=s);
Database.. AddRange (list); The database library. SaveChanges ();