public static List <T> GetAllFromEntity <T>() where T : class
 {
     using (var db = new ewkDB())
     {
         return(db.GetTable <T>().ToList());
     }
 }
        //public static List<T> GetEntitiesByParameters<T>(Func<T, bool> where) where T : class
        //{
        //    using (var db = new ewkDB())
        //    {
        //        return db.GetTable<T>().Where<T>(where).Where<T>(GetLogicExclusion<T>()).ToList);
        //    }
        //}

        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T">linqToDb Table mapped</typeparam>
        /// <param name="pk"> Have to be of the same type of primary key atribute of T table mapped</param>
        /// <returns>T linqToDb mapped class</returns>
        public static T GetEntityByPK <T>(object pk) where T : class
        {
            using (var db = new ewkDB())
            {
                var pkName     = typeof(T).GetProperties().Where(prop => prop.GetCustomAttributes(typeof(LinqToDB.Mapping.PrimaryKeyAttribute), false).Count() > 0).First();
                var expression = SimpleComparison <T>(pkName.Name, pk);

                return(db.GetTable <T>().Where <T>(expression).FirstOrDefault());
            }
        }
        /// <summary>
        /// Excelent to use to get entities by FK
        /// </summary>
        /// <typeparam name="T">Entity To Filter From DB Mapped</typeparam>
        /// <typeparam name="D">Type of property to filter using Equals Comparer</typeparam>
        /// <param name="propertyName">Name of property</param>
        /// <param name="valueToFilter">Value to filter query</param>
        /// <returns>List of T</returns>
        public static List <T> GetAllEntititiesByPropertyValue <T, D>(string propertyName, D valueToFilter)
            where T : class
        {
            if (string.IsNullOrWhiteSpace(propertyName))
            {
                return(GetAllFromEntity <T>());
            }

            var expression = SimpleComparison <T, D>(propertyName, valueToFilter);

            using (var db = new ewkDB())
            {
                var data = db.GetTable <T>().Where <T>(expression).ToList();
                return(data);
            }
        }