public override IEnumerable <T> GetAll() { IEnumerable <WidgetBase> widgetBases = WidgetBasePartService.GetAll().Select(m => m.ToWidgetBase()); foreach (var item in widgetBases) { yield return(item.CopyTo(JsonConvert.DeserializeObject <T>(item.ExtendData)) as T); } }