本文整理汇总了C#中ITracer.WriteTrace方法的典型用法代码示例。如果您正苦于以下问题:C# ITracer.WriteTrace方法的具体用法?C# ITracer.WriteTrace怎么用?C# ITracer.WriteTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITracer
的用法示例。
在下文中一共展示了ITracer.WriteTrace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DietCalculator
public DietCalculator(Diet diet, IIngredientQuantityRepository ingredientQuantityRepository, ITracer tracer)
{
_diet = diet;
_ingredientQuantityRepository = ingredientQuantityRepository;
_tracer = tracer;
tracer.WriteTrace("Henter ut ingredienser og måltid");
var ingredients = _diet.DietIngredients.ToList();
var meals = _diet.DietMeals.ToList();
foreach (var di in ingredients)
{
var quantityConversion = di.Quantity / QuantityConverter.ConvertTo100Grams(di.QuantityTypeId, _ingredientQuantityRepository.GetConvertFactor(di.IngredientId, di.QuantityTypeId)) * di.Day.ToIntArray().Count();
_totalIngredientCarbsGrams += di.Ingredient.Carb * quantityConversion;
_totalIngredientFatGrams += di.Ingredient.Fat * quantityConversion;
_totalIngredientProteinGrams += di.Ingredient.Protein * quantityConversion;
_totalIngredientKcals += di.Ingredient.Kcal * quantityConversion;
}
foreach (var dm in meals)
{
var mealDays = dm.Day.ToIntArray().Count();
var mealCalulator = new MealCalculator(dm.Meal, _ingredientQuantityRepository);
_totalMealCarbGrams += mealCalulator.CalculateTotalCarb() * mealDays;
_totalMealFatGrams += mealCalulator.CalculateTotalFat() * mealDays;
_totalMealProteinGrams += mealCalulator.CalculateTotalProtein() * mealDays;
_totalMealKcals += mealCalulator.CalculateTotalKcal() * mealDays;
}
_totalGrams = _totalIngredientCarbsGrams + _totalIngredientFatGrams + _totalIngredientProteinGrams +
_totalMealCarbGrams + _totalMealFatGrams + _totalMealProteinGrams;
_tracer.WriteTrace("Ferdig med constructor");
}