The situation is simple. There is a method GetData. It gets all the data from the database and returns it.
public List<UserData> GetData(int FL) { string sql = string.Format(@"SELECT id, guid, username, userblob, ""FL"" FROM ""USERS"" WHERE ""FL""={0};", FL); ... UserData ud = new UserData(); ud.Id = dr[0].ToString(); ud.Guid = (dr[1].ToString()); ud.Name = (dr[2].ToString()); ud.UserBlob = (byte[])dr[3]; ud.FL = dr[4].ToString(); uds.Add(ud); ... return uds; } However, I had the need to call it by passing it another SQL SELECT WHERE IN command. I cannot pass it as a string. My database is defined as an abstraction:
TargetDbContext = DbContextFactory.GetDbContext(_config.FirstDataBase); TransitDbContext = DbContextFactory.GetDbContext(_config.TransitDataBase); Just for each of the used databases, its own method is implemented: GetData and I would like to determine the request itself in the method itself, and not pass it outside. How can this be done?