/// <summary>Creates a new, empty BidderEntity object.</summary>
        /// <returns>A new, empty BidderEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new BidderEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewBidder
            // __LLBLGENPRO_USER_CODE_REGION_END

            return toReturn;
        }
 public void Insert(ref Bidder bidder,
                    ref IAuctionTransaction trans)
 {
     var b = new BidderEntity
                 {
                     Number = bidder.Number,
                     Name = bidder.Name,
                     Phone = bidder.Phone,
                     EventId = bidder.EventId,
                     CreatedBy = bidder.CreatedBy
                 };
     if(trans != null)
     {
         trans.Add(b);
     }
     b.Save();
 }
 public void Update(ref Bidder bidder,
                    ref IAuctionTransaction trans)
 {
     using (var records = new BidderCollection())
     {
         var filter = new PredicateExpression(BidderFields.Id == bidder.Id);
         var b = new BidderEntity
                     {
                         Number = bidder.Number,
                         Name = bidder.Name,
                         Phone = bidder.Phone,
                         EventId = bidder.EventId,
                         CreatedBy = bidder.CreatedBy
                     };
         if (trans != null)
         {
             trans.Add(records);
         }
         records.UpdateMulti(b, filter);
     }
 }
 /// <summary> setups the sync logic for member _bidder</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncBidder(IEntity relatedEntity)
 {
     if(_bidder!=relatedEntity)
     {
         DesetupSyncBidder(true, true);
         _bidder = (BidderEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity( _bidder, new PropertyChangedEventHandler( OnBidderPropertyChanged ), "Bidder", PackageEntity.Relations.BidderEntityUsingBidderId, true, ref _alreadyFetchedBidder, new string[] {  } );
     }
 }
        /// <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();
        }
 /// <summary> Removes the sync logic for member _bidder</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 DesetupSyncBidder(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity( _bidder, new PropertyChangedEventHandler( OnBidderPropertyChanged ), "Bidder", PackageEntity.Relations.BidderEntityUsingBidderId, true, signalRelatedEntity, "Package", resetFKFields, new int[] { (int)PackageFieldIndex.BidderId } );
     _bidder = null;
 }
        /// <summary> Retrieves the related entity of type 'BidderEntity', 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 'BidderEntity' which is related to this entity.</returns>
        public virtual BidderEntity GetSingleBidder(bool forceFetch)
        {
            if( ( !_alreadyFetchedBidder || forceFetch || _alwaysFetchBidder) && !base.IsSerializing && !base.IsDeserializing  && !base.InDesignMode)
            {
                bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(PackageEntity.Relations.BidderEntityUsingBidderId);

                BidderEntity newEntity = new BidderEntity();
                if(base.ParticipatesInTransaction)
                {
                    base.Transaction.Add(newEntity);
                }
                bool fetchResult = false;
                if(performLazyLoading)
                {
                    fetchResult = newEntity.FetchUsingPK(this.BidderId.GetValueOrDefault());
                }
                if(fetchResult)
                {
                    if(base.ActiveContext!=null)
                    {
                        newEntity = (BidderEntity)base.ActiveContext.Get(newEntity);
                    }
                    this.Bidder = newEntity;
                }
                else
                {
                    if(_bidderReturnsNewIfNotFound)
                    {
                        if(performLazyLoading || (!performLazyLoading && (_bidder == null)))
                        {
                            this.Bidder = newEntity;
                        }
                    }
                    else
                    {
                        this.Bidder = null;
                    }
                }
                _alreadyFetchedBidder = fetchResult;
                if(base.ParticipatesInTransaction && !fetchResult)
                {
                    base.Transaction.Remove(newEntity);
                }
            }
            return _bidder;
        }
        /// <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
        }