public static EmployeeInformationEntities CreateContext() { var config = ServiceConfigurationLoader.Load(); var configuration = config.ConnectionStrings[typeof(EmployeeInformationEntities).Name]; var context = new EmployeeInformationEntities(ConnectionFactory.Create(configuration)); context.configuration = configuration; return(context); }
private Employee GetAuthenticatedUserInfo(string userID) { var config = ServiceConfigurationLoader.Load(); var dir = config.AppSettings["employeeInfoQueryDir"]; var domains = ((JArray)config.AppSettings["employeeInfoTargetDomains"]).ToList(); //@archwaytest.local var whereClases = domains.Select(d => { return(string.Format("LOWER(TUSR001.AML) = LOWER(CONCAT(:UserID/*VARCHAR2(500)*/, '@{0}'))", d.Value <string>())); }); var newQuery = string.Format(sql, string.Join(" OR ", whereClases)); using (EmployeeInformationEntities context = EmployeeInformationEntities.CreateContext()) { FileSqlDefinitionFactory factory = new FileSqlDefinitionFactory("ServiceUnits/Actos/V1/"); DataQuery query = new DataQuery(context, factory, logContext).AppendQuery(newQuery); query.SetParameter("UserID", userID); return(query.GetList <Employee>().FirstOrDefault()); } }