public T1[] GetAll() { try { BaseLogic <T1> classInstance = CreateLogic(); return(classInstance.GetAll().ToArray()); } catch (Exception err) { ValidationFault fault = new ValidationFault(); fault.Result = false; fault.Message = "Read All Problem"; fault.Description = err.Message; FaultException <ValidationFault> fe = new FaultException <ValidationFault>(fault, new FaultReason(fault.Message)); throw fe; } }
// special constructor invoking method ! private T2 CreateLogic() { try { Type classType = typeof(T2); ConstructorInfo classConstructor = classType.GetConstructor(new Type[] { dataRepo.GetType() }); return(classConstructor.Invoke(new object[] { dataRepo }) as T2); } catch (Exception e) { ValidationFault fault = new ValidationFault(); fault.Result = false; fault.Message = "Service Repository initializing problem"; fault.Description = e.Message; throw new FaultException <ValidationFault>(fault); } }
public T1 GetSingle(String Id) { try { BaseLogic <T1> classInstance = CreateLogic(); // You must close or flush the trace to empty the output buffer. return(classInstance.Get(Guid.Parse(Id))); } catch (Exception err) { ValidationFault fault = new ValidationFault(); fault.Result = false; fault.Message = "Read Problem"; fault.Description = err.Message; FaultException <ValidationFault> fe = new FaultException <ValidationFault>(fault, new FaultReason(fault.Message)); throw fe; } }
public void AddSystemLanguageCode(SystemLanguageCodePoco[] list) { try { SystemLanguageCodeLogic logic = new SystemLanguageCodeLogic(new EFGenericRepository <SystemLanguageCodePoco>(false)); logic.Add(list); } catch (AggregateException e) { List <ValidationException> exceptions = e.InnerExceptions.Cast <ValidationException>().ToList(); foreach (ValidationException err in exceptions) { ValidationFault fault = new ValidationFault(); fault.Result = false; fault.Message = "Language Create Problem"; fault.Description = err.Message; FaultException <ValidationFault> fe = new FaultException <ValidationFault>(fault, new FaultReason(fault.Message)); throw fe; } } }
public void Delete(T1[] list) { try { BaseLogic <T1> classInstance = CreateLogic(); classInstance.Delete(list); } catch (AggregateException e) { List <ValidationException> exceptions = e.InnerExceptions.Cast <ValidationException>().ToList(); foreach (ValidationException err in exceptions) { ValidationFault fault = new ValidationFault(); fault.Result = false; fault.Message = "Delete Problem"; fault.Description = err.Message; FaultException <ValidationFault> fe = new FaultException <ValidationFault>(fault, new FaultReason(fault.Message)); throw fe; } } }
public SystemLanguageCodePoco[] GetAllSystemLanguageCode() { try { SystemLanguageCodeLogic logic = new SystemLanguageCodeLogic(new EFGenericRepository <SystemLanguageCodePoco>(false)); return(logic.GetAll().ToArray()); } catch (AggregateException e) { List <ValidationException> exceptions = e.InnerExceptions.Cast <ValidationException>().ToList(); foreach (ValidationException err in exceptions) { ValidationFault fault = new ValidationFault(); fault.Result = false; fault.Message = "Language Read Problem"; fault.Description = err.Message; FaultException <ValidationFault> fe = new FaultException <ValidationFault>(fault, new FaultReason(fault.Message)); throw fe; } return(null); } }