Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DataModule.WgdEntityService.GetImages(Func`2 func, IEnumerable`1 returnPaths)
- ============================================================================
- public IList<Image> GetImages(Func<Image, bool> func, IEnumerable<string> returnPaths = null)
- {
- IList<Image> list;
- IEnumerable<string> strs = returnPaths ?? new List<string>()
- {
- "ImageOpticalParameter",
- "ImageOpticalParameter.CircleShutter",
- "ImageOpticalParameter.RectangleShutter"
- };
- try
- {
- using (WgdContext wgdContext = new WgdContext(this._connectionString))
- {
- wgdContext.ContextOptions.LazyLoadingEnabled = false;
- IEnumerable<Image> images = wgdContext.Images;
- if (strs != null && strs.Count<string>() > 0)
- {
- ObjectQuery<Image> images1 = null;
- foreach (string str in strs)
- {
- images1 = (images1 == null ? wgdContext.Images.Include(str) : images1.Include(str));
- }
- object obj = images1;
- if (obj == null)
- {
- obj = images;
- }
- images = (IEnumerable<Image>)obj;
- }
- if (func != null)
- {
- images = images.Where<Image>(func);
- }
- list = images.ToList<Image>();
- }
- }
- catch (Exception exception)
- {
- throw new DataModuleException("Ошибка при выполнении функции ", exception);
- }
- return list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement