public virtual int Count() { this.SelectStr = String.Format("SELECT COUNT(*) FROM {0}", DataMapper.EscapeName(Mapping.TableName)); return(Convert.ToInt32(DataMapper.SelectScalar(SessionFactory.GetCurrentSession(typeof(T)), this))); }