public DBContexTestTemplate(TextDBName textDbName) { IEnumerable <IEntity> dataEntity = textListContena.GetTextList(textDbName); DbContext = GetArticleDbContext(); switch (textDbName) { case TextDBName.TextFile: DbContext.TextFilesList.AddRange((IEnumerable <TextFilesList>)dataEntity); DbContext.SaveChanges(); testList = DbContext.TextFilesList.ToList(); break; case TextDBName.ServiceUser: DbContext.ServiceUser.AddRange((IEnumerable <ServiceUser>)dataEntity); DbContext.SaveChanges(); testList = DbContext.TextFilesList.ToList(); break; } }
public static Type GetEntityType(this TextDBName textDBName) { return(dictionary[textDBName]); }
public IEnumerable <IEntity> GetTextList(TextDBName dbName) => testDictionary[dbName];