public List<CMSTemplateKey> SelectTemplateKeysByID(int id)
        {
            CMSTemplateKey c = null;
            List<CMSTemplateKey> listOfKeys = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CMSTemplateKeys_GetByTemplateId"
               , inputParamMapper: delegate (SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@Id", id);

               }, map: delegate (IDataReader reader, short set)
               {
                   c = new CMSTemplateKey();
                   int startingIndex = 0; //startingOrdinal

                   c.Id = reader.GetSafeInt32(startingIndex++);
                   c.Type = reader.GetSafeInt32(startingIndex++);
                   c.KeyName = reader.GetSafeString(startingIndex++);
                   c.TemplateId = reader.GetSafeInt32(startingIndex++);

                   if (listOfKeys == null)
                   {
                       listOfKeys = new List<CMSTemplateKey>();
                   }
                   listOfKeys.Add(c);
               }
               );

            return listOfKeys;
        }
        public CMSTemplateKey GetKeyById(int id)
        {
            CMSTemplateKey c = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CMSTemplateKeys_SelectByID"
               , inputParamMapper: delegate(SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@Id", id);

               }, map: delegate(IDataReader reader, short set)
               {
                   c = new CMSTemplateKey();
                   int startingIndex = 0; //startingOrdinal

                   c.Id = reader.GetSafeInt32(startingIndex++);
                   c.Type = reader.GetSafeInt32(startingIndex++);
                   c.KeyName = reader.GetSafeString(startingIndex++);
                   c.TemplateId = reader.GetSafeInt32(startingIndex++);
               }
               );

            return c;
        }