INSERT INTO [dbo].[PersonBranch](BRANCHNAME,BRANCHCODE,BRANCHDEFINE,DEFINENUMBER)SELECT DISTINCT(BRANCHNAME,BRANCHCODE,1,0) FROM [dbo].[PersonBranchDefine] WHERE BRANCHCODE NOT IN ('100','200')
int[] codestofind = new {100, 200} PersonBranch[] pbs = context.PersonBranchDefine .Where(pbd=> pbd.BranchCodes.Any(bc=>codestofind.Contains(bc.BranchCode)) .Select(pbd=>new PersonBranch(pbd.BranchName, pbd.BranchCode,1,0)) .ToList(); context.PersonBranches.AddRange(pbs); context.SaveChanges();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)