Foodolini.BusinessLogic.Nutrient Class Reference

A nutrition definition. More...

Collaboration diagram for Foodolini.BusinessLogic.Nutrient:
Collaboration graph

List of all members.

Static Public Member Functions

static ICollection< NutrientListNutritionDefinitions ()
 Returns a collection of NutritionalDefinitions in sorted order.

Properties

internal long Id [get]
string Unit [get]
 Measuring unit.
string TagName [get]
 Abbreviated name.
string Description [get]
 Full name of the nutrition definition.
int SortOrder [get]
 Sorder order for listing nutritional values.
static Nutrient Calories [get]
 Gets total calories.
static Nutrient Protein [get]
 Gets total protein.
static Nutrient Carbohydrates [get]
 Gets total carbohydrates.
static Nutrient Fat [get]
 Gets total fat.

Private Member Functions

 Nutrient (NutritionDefinition nutRow)
 Construction a Nutrient.

Static Private Member Functions

static internal Nutrient CreateNutritionDefinition (long nutritionDefinitionRowId)
 Create a Nutrient for a NutritionDefinitionRowId.
static void LoadDefinitions ()
 Load NutritionDefinitions if not already loaded.
static Nutrient FindNutrient (string tagName)
 Searches for a specific Nutrient by its TagName and returns it.

Private Attributes

NutritionDefinition nutRow

Static Private Attributes

static Dictionary< long, Nutrientdefinitions = null
 Lazily loaded dictionary of NutritionDefinitions, this is loaded by Nutrient.LoadDefinitions.

Detailed Description

A nutrition definition.

There only exists a few NutritionDefinitionRows in the database, but these are often used. Therefore this class is lazily caches a static list of all NutritionDefinitions and returns these using the factory methods. This approach used to minimize required database queries.

Also note that new NutritionDefinitionRows cannot be created, and existing ones cannot be changed.

Definition at line 18 of file Nutrient.cs.


Constructor & Destructor Documentation

Foodolini.BusinessLogic.Nutrient.Nutrient ( NutritionDefinition  nutRow  )  [private]

Construction a Nutrient.

Definition at line 25 of file Nutrient.cs.


Member Function Documentation

static internal Nutrient Foodolini.BusinessLogic.Nutrient.CreateNutritionDefinition ( long  nutritionDefinitionRowId  )  [static, private]

Create a Nutrient for a NutritionDefinitionRowId.

This uses a static lazily loaded list to avoid querying the database.

Definition at line 85 of file Nutrient.cs.

static Nutrient Foodolini.BusinessLogic.Nutrient.FindNutrient ( string  tagName  )  [static, private]

Searches for a specific Nutrient by its TagName and returns it.

Parameters:
tagName 
Returns:
Nutrient

Definition at line 151 of file Nutrient.cs.

static ICollection<Nutrient> Foodolini.BusinessLogic.Nutrient.ListNutritionDefinitions (  )  [static]

Returns a collection of NutritionalDefinitions in sorted order.

Returns:
A ICollection<Nutrient> sorted by SortOrder

Definition at line 162 of file Nutrient.cs.

static void Foodolini.BusinessLogic.Nutrient.LoadDefinitions (  )  [static, private]

Load NutritionDefinitions if not already loaded.

Definition at line 101 of file Nutrient.cs.


Member Data Documentation

Dictionary<long, Nutrient> Foodolini.BusinessLogic.Nutrient.definitions = null [static, private]

Lazily loaded dictionary of NutritionDefinitions, this is loaded by Nutrient.LoadDefinitions.

Definition at line 96 of file Nutrient.cs.

Definition at line 20 of file Nutrient.cs.


Property Documentation

Nutrient Foodolini.BusinessLogic.Nutrient.Calories [static, get]

Gets total calories.

Id = 208

Definition at line 115 of file Nutrient.cs.

Nutrient Foodolini.BusinessLogic.Nutrient.Carbohydrates [static, get]

Gets total carbohydrates.

Id = 205

Definition at line 133 of file Nutrient.cs.

string Foodolini.BusinessLogic.Nutrient.Description [get]

Full name of the nutrition definition.

Definition at line 63 of file Nutrient.cs.

Nutrient Foodolini.BusinessLogic.Nutrient.Fat [static, get]

Gets total fat.

Id = 204

Definition at line 142 of file Nutrient.cs.

internal long Foodolini.BusinessLogic.Nutrient.Id [get, private]

Definition at line 30 of file Nutrient.cs.

Nutrient Foodolini.BusinessLogic.Nutrient.Protein [static, get]

Gets total protein.

Id = 203

Definition at line 124 of file Nutrient.cs.

int Foodolini.BusinessLogic.Nutrient.SortOrder [get]

Sorder order for listing nutritional values.

Definition at line 73 of file Nutrient.cs.

string Foodolini.BusinessLogic.Nutrient.TagName [get]

Abbreviated name.

Definition at line 52 of file Nutrient.cs.

string Foodolini.BusinessLogic.Nutrient.Unit [get]

Measuring unit.

Definition at line 41 of file Nutrient.cs.


The documentation for this class was generated from the following file:

Foodolini 1.0.0 Documentation, generated with DoxyGen.