Editor.Services.PageServices.GetStructures C# (CSharp) Method

GetStructures() public method

public GetStructures ( ) : List
return List
        public List<StructureDTO> GetStructures()
        {
            using (ISession session = HibernateHelper.GetSession().OpenSession()) {
                using (ITransaction transaction = session.BeginTransaction()) {
                    try {
                        List<Structure> structures = new List<Structure>();
                        structures = HibernateHelper.SelectCommand<Structure>(session, "");

                        Mapper.CreateMap<Structure, StructureDTO>();

                        return Mapper.Map<List<Structure>, List<StructureDTO>>(structures);

                    } catch (Exception ex) {
                        throw ex;
                    } finally {
                        session.Flush();
                        session.Close();
                    }
                }

            }
        }