/// <summary>
        /// Maps relations.
        /// </summary>
        /// <param name="dataProvider">Implementation of the data provider used to access data.</param>
        public virtual void MapRelations(IDataProviderBase <MySqlDataReader, MySqlCommand> dataProvider)
        {
            ArgumentNullGuard.NotNull(dataProvider, nameof(dataProvider));

            if (Identifier.HasValue == false)
            {
                throw new IntranetRepositoryException(Resource.GetExceptionMessage(ExceptionMessage.IllegalValue, Identifier, "Identifier"));
            }

            Children     = new List <IFoodGroup>(GetFoodGroupChildren(dataProvider, Identifier.Value));
            Translations = new List <ITranslation>(TranslationProxy.GetDomainObjectTranslations(dataProvider, Identifier.Value));
            ForeignKeys  = new List <IForeignKey>(ForeignKeyProxy.GetDomainObjectForeignKeys(dataProvider, Identifier.Value));

            _dataProvider = (IFoodWasteDataProvider)dataProvider;
        }
예제 #2
0
        /// <summary>
        /// Maps relations.
        /// </summary>
        /// <param name="dataProvider">Implementation of the data provider used to access data.</param>
        public virtual void MapRelations(IDataProviderBase <MySqlDataReader, MySqlCommand> dataProvider)
        {
            ArgumentNullGuard.NotNull(dataProvider, nameof(dataProvider));

            if (Identifier.HasValue == false)
            {
                throw new IntranetRepositoryException(Resource.GetExceptionMessage(ExceptionMessage.IllegalValue, Identifier, "Identifier"));
            }

            IList <FoodItemGroupProxy> foodItemGroupProxyCollection = new List <FoodItemGroupProxy>(FoodItemGroupProxy.GetFoodItemGroups(dataProvider, Identifier.Value));

            PrimaryFoodGroup = foodItemGroupProxyCollection.Single(m => m.IsPrimary).FoodGroup;
            FoodGroups       = new List <IFoodGroup>(foodItemGroupProxyCollection.Select(m => m.FoodGroup));
            Translations     = new List <ITranslation>(TranslationProxy.GetDomainObjectTranslations(dataProvider, Identifier.Value));
            ForeignKeys      = new List <IForeignKey>(ForeignKeyProxy.GetDomainObjectForeignKeys(dataProvider, Identifier.Value));

            _dataProvider = (IFoodWasteDataProvider)dataProvider;
        }