protected TProperty GetPrimaryKey <TProperty>(T item)
        {
            Type modelType = typeof(T);

            //Get the primary key
            var primaryKeyName = DataUtil.GetPrimaryKeyProperty(modelType, String.Empty);

            return(GetPropertyValue <TProperty>(item, primaryKeyName));
        }
        public void Delete(TEntity entity)
        {
            // Argument Contract
            Requires.NotNull(entity);

            var primaryKey = DataUtil.GetPrimaryKeyProperty(typeof(TEntity), string.Empty);
            Requires.PropertyNotNull(entity, primaryKey);
            Requires.PropertyNotNegative(entity, primaryKey);

            using (this.DataContext)
            {
                var rep = this.DataContext.GetRepository<TEntity>();

                rep.Delete(entity);
            }
        }