Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lssweatherhead
Last active August 18, 2019 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lssweatherhead/194542ef0cbb29023054e7aebdcc1651 to your computer and use it in GitHub Desktop.
Save lssweatherhead/194542ef0cbb29023054e7aebdcc1651 to your computer and use it in GitHub Desktop.
Code excerpts from Umbraco GraphQL Custom Data Sections
[TableName("ItemTypes")]
[PrimaryKey("Id", autoIncrement = true)]
[ExplicitColumns]
public class ItemType
{
[Column("Id")]
[PrimaryKeyColumn(AutoIncrement = true)]
public int Id { get; set; }
[Column("Name")]
public string Name { get; set; }
}
[TableName("Items")]
[PrimaryKey("Id", autoIncrement = true)]
[ExplicitColumns]
public class Item
{
[Column("Id")]
[PrimaryKeyColumn(AutoIncrement = true)]
public int Id { get; set; }
[Column("ItemName")]
public string ItemName { get; set; }
[Column("ItemType")]
[ForeignKey(typeof(ItemType), Name = "FK_Item_TypeId")]
public int ItemType { get; set; }
[Column("MinCO2eGrams")]
public double MinCarbonDioxideEquivalent { get; set; }
[Column("MaxCO2eGrams")]
[NullSetting(NullSetting = NullSettings.Null)]
public double MaxCarbonDioxideEquivalent { get; set; }
}
[TableName("Variants")]
[PrimaryKey("Id", autoIncrement = true)]
[ExplicitColumns]
public class Variant
{
[Column("Id")]
[PrimaryKeyColumn(AutoIncrement = true)]
public int Id { get; set; }
[Column("VariantName")]
public string VariantName { get; set; }
[Column("Item")]
[ForeignKey(typeof(Item), Name = "FK_Variant_ItemId")]
public int Item { get; set; }
[Column("CO2eGrams")]
public double CarbonDioxideEquivalent { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment