ExternalEntityLinkServerFunctions.cs
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Domain.SessionExtensions;
using Sungero.Domain.Shared;
using DirRX.LongTermArchive.ExternalEntityLink;
namespace DirRX.LongTermArchive.Server
{
partial class ExternalEntityLinkFunctions
{
/// <summary>
/// Получить все экземпляры сущностей указанного типа.
/// </summary>
/// <returns>Список записей текущей сущности.</returns>
[Remote]
public IQueryable<IEntity> GetEntities()
{
IQueryable<IEntity> entities = null;
if (!string.IsNullOrWhiteSpace(_obj.EntityType))
{
try
{
using (var session = new Sungero.Domain.Session())
{
entities = session.GetAll(Sungero.Domain.Shared.TypeExtension.GetTypeByGuid(Guid.Parse(_obj.EntityType)));
}
}
catch (Exception e)
{
Logger.DebugFormat("Ошибка получения элементов сущности по ее типу: {0}", e.Message);
}
}
return entities;
}
}
}