<commit_before>﻿using System;
using Sitecore.Data;

namespace AutoSitecore
{
  [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
  public class ItemDataAttribute : Attribute
  {
    public static readonly ItemDataAttribute Null = new ItemDataAttribute();

    public ItemDataAttribute(string name=null, string id = null, string templateId= null)
    {
      this.Name = name;
      ID result;
      if (ID.TryParse(templateId, out result))
      {
        TemplateId = result;
      }
      else
      {
        TemplateId = ID.Null;
      }
      ID result2;
     
      if (ID.TryParse(id, out result2))
      {
        ItemId = result2;
      }
      else
      {
        ItemId = ID.Undefined;
      }

    }

    public string Name { get; }
    public ID TemplateId { get; }
    public ID ItemId { get; }
  }
}<commit_msg>Improve error messages for invalid Guids in ItemData<commit_after>﻿using System;
using Sitecore.Data;

namespace AutoSitecore
{
  [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
  public class ItemDataAttribute : Attribute
  {
    public static readonly ItemDataAttribute Null = new ItemDataAttribute();

    public ItemDataAttribute(string name=null, string itemId = null, string templateId= null)
    {
      Name = name;
      ItemId = ID.Parse(itemId, ID.Undefined);
      TemplateId = ID.Parse(templateId, ID.Undefined);
    }

    public string Name { get; }
    public ID TemplateId { get; }
    public ID ItemId { get; }
  }
}
{'fraction_non_alphanumeric': 0.08872581721147432, 'fraction_numerical': 0.0020013342228152103, 'mean_word_length': 2.6945812807881775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3089392', 'n_tokens_mistral': 441, 'n_tokens_neox': 433, 'n_words': 121}