//copy from ORacle db to sql with new contexts public void ORCL_to_SQL_copy_FULL() { ORCL_HR ORCL_DB = new ORCL_HR(); SQL_HR_COPY SQL_DB = new SQL_HR_COPY(); IQueryable <SB.Entities.COUNTRIES> regions = from s in ORCL_DB.COUNTRIES select s; foreach (SB.Entities.COUNTRIES rg in regions) { SQL_DB.COUNTRIES.Add(new SB.Entities.COUNTRIES { COUNTRY_ID = rg.COUNTRY_ID, COUNTRY_NAME = rg.COUNTRY_NAME, REGION_ID = rg.REGION_ID }); SQL_DB.SaveChanges(); } }
//checking of generic repository from .DAL.Repository.cs public void RepoCheck() { ORCL_HR orcl_db = new ORCL_HR(); SB.Entities.COUNTRIES ctr = new SB.Entities.COUNTRIES(); Repository <SB.Entities.COUNTRIES> repo = new Repository <SB.Entities.COUNTRIES>(orcl_db); IQueryable <SB.Entities.COUNTRIES> items = repo.GetAll(); int item_count = items.Count(); RepositoryCountries repoCountries = new RepositoryCountries(orcl_db); items = repoCountries.countriesByRegion(1); item_count = items.Count(); repoCountries.display(items); }
public void ORCL_to_SQL_copy_repo() { ORCL_HR ORCL_DB = new ORCL_HR(); SQL_HR_COPY SQL_DB = new SQL_HR_COPY(); Repository <LOCATIONS> orcl_jobs = new Repository <LOCATIONS>(ORCL_DB); Repository <LOCATIONS> sql_jobs = new Repository <LOCATIONS>(SQL_DB); IEnumerable <LOCATIONS> jobs_ = orcl_jobs.GetAll().AsNoTracking(); //works for entity with no navigation properties foreach (LOCATIONS jb in jobs_) { //sql_jobs.Add(new JOBS { JOB_ID=jb.JOB_ID, JOB_TITLE=jb.JOB_TITLE,MIN_SALARY=jb.MIN_SALARY,MAX_SALARY=jb.MAX_SALARY} ); sql_jobs.Add(jb); sql_jobs.SaveChnages(); } }