public static T GetById <T>(int id) where T : EntityObject { //EntityService<T> service = new EntityService<T>(); //T result = service.GetById(id); //return result; EntityWCFServiceClient client = new EntityWCFServiceClient(); EntityObject response = client.GetById(typeof(T).FullName, id); T result = response as T; return(result); }
public static List <T> GetByTemplate <T>(T template) where T : EntityObject { //EntityService<T> service = new EntityService<T>(); //List<T> result = service.GetByTemplate(template); //return result; List <T> result = new List <T>(); EntityWCFServiceClient client = new EntityWCFServiceClient(); EntityObject[] response = client.GetByTemplate(typeof(T).FullName, template); foreach (T item in response) { result.Add(item); } return(result); }