public void Insert(ref Category category, ref IAuctionTransaction trans)
 {
     var c = new CategoryEntity
     {
         AccountId = category.AccountId,
         Name = category.Name
     };
     if (trans != null)
     {
         trans.Add(c);
     }
     c.Save();
 }
 public void Update(ref Category category, ref IAuctionTransaction trans)
 {
     using (var records = new CategoryCollection())
     {
         var filter = new PredicateExpression(CategoryFields.Id == category.Id);
         var c = new CategoryEntity
                     {
                         AccountId = category.AccountId,
                         Name = category.Name
                     };
         if (trans != null)
         {
             trans.Add(records);
         }
         records.UpdateMulti(c, filter);
     }
 }
Ejemplo n.º 3
0
        /// <summary>Creates a new, empty CategoryEntity object.</summary>
        /// <returns>A new, empty CategoryEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new CategoryEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewCategory
            // __LLBLGENPRO_USER_CODE_REGION_END

            return toReturn;
        }
Ejemplo n.º 4
0
 /// <summary> setups the sync logic for member _category</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncCategory(IEntity relatedEntity)
 {
     if(_category!=relatedEntity)
     {
         DesetupSyncCategory(true, true);
         _category = (CategoryEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity( _category, new PropertyChangedEventHandler( OnCategoryPropertyChanged ), "Category", PackageEntity.Relations.CategoryEntityUsingCategoryId, true, ref _alreadyFetchedCategory, new string[] {  } );
     }
 }
Ejemplo n.º 5
0
        /// <summary> Initializes the class members</summary>
        private void InitClassMembers()
        {
            _donation = new Auction.Entities.CollectionClasses.DonationCollection(new DonationEntityFactory());
            _donation.SetContainingEntityInfo(this, "Package");
            _alwaysFetchDonation = false;
            _alreadyFetchedDonation = false;
            _auctionEventCollectionViaDonation = new Auction.Entities.CollectionClasses.AuctionEventCollection(new AuctionEventEntityFactory());
            _alwaysFetchAuctionEventCollectionViaDonation = false;
            _alreadyFetchedAuctionEventCollectionViaDonation = false;
            _donorCollectionViaDonation = new Auction.Entities.CollectionClasses.DonorCollection(new DonorEntityFactory());
            _alwaysFetchDonorCollectionViaDonation = false;
            _alreadyFetchedDonorCollectionViaDonation = false;
            _userCollectionViaDonation_ = new Auction.Entities.CollectionClasses.UserCollection(new UserEntityFactory());
            _alwaysFetchUserCollectionViaDonation_ = false;
            _alreadyFetchedUserCollectionViaDonation_ = false;
            _userCollectionViaDonation = new Auction.Entities.CollectionClasses.UserCollection(new UserEntityFactory());
            _alwaysFetchUserCollectionViaDonation = false;
            _alreadyFetchedUserCollectionViaDonation = false;
            _auctionEvent = null;
            _auctionEventReturnsNewIfNotFound = true;
            _alwaysFetchAuctionEvent = false;
            _alreadyFetchedAuctionEvent = false;
            _bidder = null;
            _bidderReturnsNewIfNotFound = true;
            _alwaysFetchBidder = false;
            _alreadyFetchedBidder = false;
            _category = null;
            _categoryReturnsNewIfNotFound = true;
            _alwaysFetchCategory = false;
            _alreadyFetchedCategory = false;
            _user__ = null;
            _user__ReturnsNewIfNotFound = true;
            _alwaysFetchUser__ = false;
            _alreadyFetchedUser__ = false;
            _user_ = null;
            _user_ReturnsNewIfNotFound = true;
            _alwaysFetchUser_ = false;
            _alreadyFetchedUser_ = false;
            _user = null;
            _userReturnsNewIfNotFound = true;
            _alwaysFetchUser = false;
            _alreadyFetchedUser = false;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END

            OnInitClassMembersComplete();
        }
Ejemplo n.º 6
0
 /// <summary> Removes the sync logic for member _category</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncCategory(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity( _category, new PropertyChangedEventHandler( OnCategoryPropertyChanged ), "Category", PackageEntity.Relations.CategoryEntityUsingCategoryId, true, signalRelatedEntity, "Package", resetFKFields, new int[] { (int)PackageFieldIndex.CategoryId } );
     _category = null;
 }
Ejemplo n.º 7
0
        /// <summary> Retrieves the related entity of type 'CategoryEntity', using a relation of type 'n:1'</summary>
        /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
        /// <returns>A fetched entity of type 'CategoryEntity' which is related to this entity.</returns>
        public virtual CategoryEntity GetSingleCategory(bool forceFetch)
        {
            if( ( !_alreadyFetchedCategory || forceFetch || _alwaysFetchCategory) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)
            {
                bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(PackageEntity.Relations.CategoryEntityUsingCategoryId);

                CategoryEntity newEntity = new CategoryEntity();
                if(base.ParticipatesInTransaction)
                {
                    base.Transaction.Add(newEntity);
                }
                bool fetchResult = false;
                if(performLazyLoading)
                {
                    fetchResult = newEntity.FetchUsingPK(this.CategoryId);
                }
                if(fetchResult)
                {
                    if(base.ActiveContext!=null)
                    {
                        newEntity = (CategoryEntity)base.ActiveContext.Get(newEntity);
                    }
                    this.Category = newEntity;
                }
                else
                {
                    if(_categoryReturnsNewIfNotFound)
                    {
                        if(performLazyLoading || (!performLazyLoading && (_category == null)))
                        {
                            this.Category = newEntity;
                        }
                    }
                    else
                    {
                        this.Category = null;
                    }
                }
                _alreadyFetchedCategory = fetchResult;
                if(base.ParticipatesInTransaction && !fetchResult)
                {
                    base.Transaction.Remove(newEntity);
                }
            }
            return _category;
        }
Ejemplo n.º 8
0
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected PackageEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _donation = (Auction.Entities.CollectionClasses.DonationCollection)info.GetValue("_donation", typeof(Auction.Entities.CollectionClasses.DonationCollection));
            _alwaysFetchDonation = info.GetBoolean("_alwaysFetchDonation");
            _alreadyFetchedDonation = info.GetBoolean("_alreadyFetchedDonation");
            _auctionEventCollectionViaDonation = (Auction.Entities.CollectionClasses.AuctionEventCollection)info.GetValue("_auctionEventCollectionViaDonation", typeof(Auction.Entities.CollectionClasses.AuctionEventCollection));
            _alwaysFetchAuctionEventCollectionViaDonation = info.GetBoolean("_alwaysFetchAuctionEventCollectionViaDonation");
            _alreadyFetchedAuctionEventCollectionViaDonation = info.GetBoolean("_alreadyFetchedAuctionEventCollectionViaDonation");
            _donorCollectionViaDonation = (Auction.Entities.CollectionClasses.DonorCollection)info.GetValue("_donorCollectionViaDonation", typeof(Auction.Entities.CollectionClasses.DonorCollection));
            _alwaysFetchDonorCollectionViaDonation = info.GetBoolean("_alwaysFetchDonorCollectionViaDonation");
            _alreadyFetchedDonorCollectionViaDonation = info.GetBoolean("_alreadyFetchedDonorCollectionViaDonation");
            _userCollectionViaDonation_ = (Auction.Entities.CollectionClasses.UserCollection)info.GetValue("_userCollectionViaDonation_", typeof(Auction.Entities.CollectionClasses.UserCollection));
            _alwaysFetchUserCollectionViaDonation_ = info.GetBoolean("_alwaysFetchUserCollectionViaDonation_");
            _alreadyFetchedUserCollectionViaDonation_ = info.GetBoolean("_alreadyFetchedUserCollectionViaDonation_");
            _userCollectionViaDonation = (Auction.Entities.CollectionClasses.UserCollection)info.GetValue("_userCollectionViaDonation", typeof(Auction.Entities.CollectionClasses.UserCollection));
            _alwaysFetchUserCollectionViaDonation = info.GetBoolean("_alwaysFetchUserCollectionViaDonation");
            _alreadyFetchedUserCollectionViaDonation = info.GetBoolean("_alreadyFetchedUserCollectionViaDonation");
            _auctionEvent = (AuctionEventEntity)info.GetValue("_auctionEvent", typeof(AuctionEventEntity));
            if(_auctionEvent!=null)
            {
                _auctionEvent.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _auctionEventReturnsNewIfNotFound = info.GetBoolean("_auctionEventReturnsNewIfNotFound");
            _alwaysFetchAuctionEvent = info.GetBoolean("_alwaysFetchAuctionEvent");
            _alreadyFetchedAuctionEvent = info.GetBoolean("_alreadyFetchedAuctionEvent");
            _bidder = (BidderEntity)info.GetValue("_bidder", typeof(BidderEntity));
            if(_bidder!=null)
            {
                _bidder.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _bidderReturnsNewIfNotFound = info.GetBoolean("_bidderReturnsNewIfNotFound");
            _alwaysFetchBidder = info.GetBoolean("_alwaysFetchBidder");
            _alreadyFetchedBidder = info.GetBoolean("_alreadyFetchedBidder");
            _category = (CategoryEntity)info.GetValue("_category", typeof(CategoryEntity));
            if(_category!=null)
            {
                _category.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _categoryReturnsNewIfNotFound = info.GetBoolean("_categoryReturnsNewIfNotFound");
            _alwaysFetchCategory = info.GetBoolean("_alwaysFetchCategory");
            _alreadyFetchedCategory = info.GetBoolean("_alreadyFetchedCategory");
            _user__ = (UserEntity)info.GetValue("_user__", typeof(UserEntity));
            if(_user__!=null)
            {
                _user__.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _user__ReturnsNewIfNotFound = info.GetBoolean("_user__ReturnsNewIfNotFound");
            _alwaysFetchUser__ = info.GetBoolean("_alwaysFetchUser__");
            _alreadyFetchedUser__ = info.GetBoolean("_alreadyFetchedUser__");
            _user_ = (UserEntity)info.GetValue("_user_", typeof(UserEntity));
            if(_user_!=null)
            {
                _user_.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _user_ReturnsNewIfNotFound = info.GetBoolean("_user_ReturnsNewIfNotFound");
            _alwaysFetchUser_ = info.GetBoolean("_alwaysFetchUser_");
            _alreadyFetchedUser_ = info.GetBoolean("_alreadyFetchedUser_");
            _user = (UserEntity)info.GetValue("_user", typeof(UserEntity));
            if(_user!=null)
            {
                _user.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _userReturnsNewIfNotFound = info.GetBoolean("_userReturnsNewIfNotFound");
            _alwaysFetchUser = info.GetBoolean("_alwaysFetchUser");
            _alreadyFetchedUser = info.GetBoolean("_alreadyFetchedUser");

            base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }