public Definition GetDefinityionIdByName(string name, DefTypes type)
 {
     var db = GetObjectContext();
     {
         return(db.Definitions.FirstOrDefault(d => d.TypeId == (int)type && d.Name == name));
     }
 }
        public DefType GetByType(DefTypes current)
        {
            DefType result;
            var     db = GetObjectContext();

            {
                var query = from entity in db.DefTypes
                            where entity.Id == (int)current
                            select entity;
                result = query.FirstOrDefault();
            }
            return(result);
        }
        public List <Definition> List(DefTypes defTypes)
        {
            var criteria = new SelectCriteria <Definition>
            {
                PageSize       = Int32.MaxValue,
                ExpressionSort = new List <Expression <Func <Definition, dynamic> > > {
                    item => item.Code, item => item.Name
                },
                ExpressionSelect = new List <Expression <Func <Definition, bool> > >
                {
                    item => item.TypeId == (int)defTypes,
                    item => item.Status == (int)DefStatus.Active
                }
            };

            return(List(criteria));
        }