Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.