private DataAccessContext GetContext(DbDataReader r) { //if it's not a valid context something has gone very wrong DataAccessContext context; if (!DataAccessContext.TryParse((string)r["Context"], out context)) { throw new Exception("Invalid DataAccessContext " + r["Context"]); } return(context); }
/// <summary> /// Helper that returns 1-M results (where there is only one originating TableInfo, if there are more than 1 table info in your SQL query you will get key collisions) /// </summary> /// <param name="r"></param> /// <returns></returns> private Dictionary <DataAccessContext, int> GetLinksFromReader(DbDataReader r) { var toReturn = new Dictionary <DataAccessContext, int>(); //gets the first liscenced usage while (r.Read()) { //get the context DataAccessContext context; //if it's not a valid context something has gone very wrong if (!DataAccessContext.TryParse((string)r["Context"], out context)) { throw new Exception("Invalid DataAccessContext " + r["Context"]); } //there is only one credentials per context per table info so dont worry about key collisions they should be impossible toReturn.Add(context, Convert.ToInt32(r["DataAccessCredentials_ID"])); } return(toReturn); }