public SelectColumnBasedElement(string parameterName, ICompositeKey primaryKey)
        {
            _ParameterName = parameterName ?? throw new ArgumentNullException(nameof(parameterName));
            PrimaryKey     = primaryKey ?? throw new ArgumentNullException(nameof(primaryKey));

            _Column = null;
        }
 public static TCompositeKey Merge <TCompositeKey>(
     this TCompositeKey compositeKey, ICompositeKey otherKey,
     string namePrefix = null) where TCompositeKey : ICompositeKey
 {
     otherKey.ForEach(_ => compositeKey.Add($"{namePrefix}{_.Key}", _.Value));
     return(compositeKey);
 }
Exemple #3
0
 public GateAction(ICompositeKey <GateAction> id, string name, DateTimeOffset beginDateTime,
                   GateEntityReference <GateHallScheme> hallSchemeReference,
                   ExtraData extraData = null) : base(id, name, extraData)
 {
     BeginDateTime       = beginDateTime;
     HallSchemeReference = hallSchemeReference;
 }
Exemple #4
0
 ICompositeKey GetPrimaryKey()
 {
     lock (_lock)
     {
         return(_PrimaryKey ?? (_PrimaryKey = BuildPrimaryKey()));
     }
 }
        public SelectColumnBasedElement(ISelectColumn column, ICompositeKey primaryKey)
        {
            _Column    = column ?? throw new ArgumentNullException(nameof(column));
            PrimaryKey = primaryKey ?? throw new ArgumentNullException(nameof(primaryKey));

            _ParameterName = null;
        }
 public GateOrderTicketAgentData(ICompositeKey <GateTicket> gateTicketKey, string number,
                                 string barcode, BarcodeType barcodeType)
 {
     Number        = number;
     Barcode       = barcode;
     BarcodeType   = barcodeType;
     GateTicketKey = gateTicketKey;
 }
 public GateHallScheme(ICompositeKey <GateHallScheme> id, string name,
                       GateHall hall,
                       GateHallArea[] areas,
                       ExtraData extraData = null) : base(id, name, extraData)
 {
     Hall  = hall;
     Areas = areas;
 }
 public static ICompositeKey <TGateEntity> SetComponent <TGateEntity, TValue>(
     this ICompositeKey <TGateEntity> compositeKey,
     Func <ICompositeKey <TGateEntity>, ICompositeKeyComponentAccessor <TValue> > getAccessor,
     TValue value)
     where TGateEntity : IGateEntity
 {
     getAccessor(compositeKey).Set(value);
     return(compositeKey);
 }
Exemple #9
0
 public SqlSelectColumn(QueryElementBasedMappedProperty prop, ICompositeKey columnKey)
     : this(
         prop.To,
         prop.MappedPropertyType,
         prop.PropertySegmentConstructors,
         columnKey,
         prop.MappingContext)
 {
 }
Exemple #10
0
 public GateOrder(ICompositeKey <GateOrder> id, string name,
                  GateEntityReference <GateCustomer> customerReference, DateTimeOffset?expires,
                  GateOrderTicket[] orderTickets, GateEntityReference <GatePayment> paymentReference, GateOrderState state,
                  ExtraData extraData = null) : base(id, name,
                                                     extraData)
 {
     CustomerReference = customerReference;
     Expires           = expires;
     OrderTickets      = orderTickets;
     PaymentReference  = paymentReference;
     State             = state;
 }
Exemple #11
0
 public GateTicket(ICompositeKey <GateTicket> id, string name,
                   GateEntityReference <GateHallArea> hallAreaReference,
                   GateEntityReference <GateHallSeat> seatReference, GateEntityReference <GateTariff> tariffReference,
                   decimal price, GateEntityReference <GateTicketType> ticketTypeReference, GateTicketState state,
                   ExtraData extraData = null) : base(id, name, extraData)
 {
     SeatReference       = seatReference;
     TariffReference     = tariffReference;
     Price               = price;
     TicketTypeReference = ticketTypeReference;
     State               = state;
     HallAreaReference   = hallAreaReference;
 }
 public GateOrderTicket(ICompositeKey <GateOrderTicket> id, string name,
                        GateEntityReference <GateTicket> ticketReference,
                        GateEntityReference <GateHallSeat> seatReference, GateEntityReference <GateTariff> tariffReference,
                        decimal price,
                        GateEntityReference <GateTicketType> ticketTypeReference,
                        string barcode      = null,
                        ExtraData extraData = null) : base(id,
                                                           name, extraData)
 {
     TicketReference     = ticketReference;
     SeatReference       = seatReference;
     TariffReference     = tariffReference;
     Price               = price;
     Barcode             = barcode;
     TicketTypeReference = ticketTypeReference;
 }
        public virtual ICompositeKey GetCompositeKey()
        {
            if (_cachedKey != null)
            {
                return(_cachedKey);
            }

            lock (_lock)
            {
                if (_cachedKey != null)
                {
                    return(_cachedKey);
                }

                _cachedKey = CreateCompositeKeyInternal();
            }

            return(_cachedKey);
        }
Exemple #14
0
 public GateHallArea(ICompositeKey <GateHallArea> id, string name, GateHallAreaType areaType,
                     ExtraData extraData = null) : base(id, name, extraData)
 {
     AreaType = areaType;
 }
Exemple #15
0
 public GateCustomer(ICompositeKey <GateCustomer> id, string name, ExtraData extraData = null) : base(id, name,
                                                                                                      extraData)
 {
 }
 public GateEntityBase(ICompositeKey <TEntity> id, string name, ExtraData extraData = null)
 {
     Id        = id;
     Name      = name;
     ExtraData = extraData ?? new ExtraData();
 }
 public GateEntityReference(ICompositeKey <TEntity> key, string name, ExtraData extraData = null)
 {
     Key       = key;
     Name      = name;
     ExtraData = extraData ?? new ExtraData();
 }
 public GateHallSeatsArea(ICompositeKey <GateHallArea> id, string name, GateHallAreaType areaType,
                          GateHallSeat[] seats, ExtraData extraData = null) : base(id, name, areaType, extraData)
 {
     Seats = seats;
 }
Exemple #19
0
        static IEnumerable <ISelectColumn> BuildColumns(IEnumerable <QueryElementBasedMappedProperty> properties, IEnumerable <StrongMappedTable> tables, ICompositeKey primaryTableKey)
        {
            var ridsForEachColumn = properties
                                    .Select(TryCombineWithRowNumberColumn)
                                    .ToArray();

            var rids = ridsForEachColumn
                       .Select(x => x.Item2)
                       .RemoveNulls()
                       .Concat(tables
                               .Where(t => !t.TableResultsAreAggregated)
                               .Select(t => t.From.PrimaryKey))
                       .Prepend(primaryTableKey)
                       .Distinct();

            foreach (var rid in rids.FillOutRIDSelectColumns().SelectMany())
            {
                yield return(rid);
            }

            foreach (var prop in ridsForEachColumn)
            {
                yield return(new SqlSelectColumn(prop.Item1, prop.Item2 ?? primaryTableKey));
            }
        }
Exemple #20
0
 public SqlSelectColumns(IEnumerable <QueryElementBasedMappedProperty> properties, IEnumerable <StrongMappedTable> tables, ICompositeKey primaryTableKey)
 {
     Columns = BuildColumns(properties, tables, primaryTableKey).Enumerate();
 }
Exemple #21
0
 public SqlSelectColumn(string alias, Type dataType, ConstructorInfo[] argConstructors, ICompositeKey columnKey, IEnumerable <IQueryTable> mappingContext)
 {
     Alias           = alias ?? throw new ArgumentNullException(nameof(alias));
     ArgConstructors = argConstructors ?? throw new ArgumentNullException(nameof(argConstructors));
     DataType        = dataType ?? throw new ArgumentNullException(nameof(dataType));
     PrimaryKey      = columnKey ?? throw new ArgumentNullException(nameof(columnKey));
     MappingContext  = mappingContext ?? throw new ArgumentNullException(nameof(mappingContext));
 }
Exemple #22
0
        /// <summary>
        /// Get a list of pk columns which is a chain from the "forKey" value to the "root", containing the "context"
        /// <summary>
        public static IEnumerable <ICompositeKey> SupplimentPrimaryKeyColumns(this ISqlSelectStatement sqlStatement, ICompositeKey forKey, IQueryTable context)
        {
            // if the piece is a parameter, Table will be null
            if (forKey == null)
            {
                return(Enumerable.Empty <ICompositeKey>());
            }

            var path = forKey.Table
                       .GetPrimaryKeyColumns(context)
                       .ToArray();

            if (path.Contains(context.PrimaryKey))
            {
                return(path);
            }

            // in this case a column is being used in the
            // context of one of its child properties
            return(context.GetPrimaryKeyColumns(forKey.Table));
        }
Exemple #23
0
 public GateHall(ICompositeKey <GateHall> id, string name, GateEntityReference <GateVenue> venueReference,
                 ExtraData extraData = null) : base(id, name, extraData)
 {
     VenueReference = venueReference;
 }
Exemple #24
0
 public GateEvent(ICompositeKey <GateEvent> id, string name, ExtraData extraData = null) : base(id, name,
                                                                                                extraData)
 {
 }
 public CompositeKeyComponentAccessor(ICompositeKey compositeKey, string componentName)
 {
     CompositeKey  = compositeKey;
     ComponentName = componentName;
 }
Exemple #26
0
 public static IEnumerable <int> GetRowNumberColumnIndexes(this ISqlSelectStatement sqlStatement, ICompositeKey key, IQueryTable context)
 {
     return(sqlStatement.GetRowNumberColumnIndexes(sqlStatement.SupplimentPrimaryKeyColumns(key, context)));
 }
 public GateHallCompoundArea(ICompositeKey <GateHallArea> id, string name, GateHallAreaType areaType,
                             GateHallArea[] subAreas,
                             ExtraData extraData = null) : base(id, name, areaType, extraData)
 {
     SubAreas = subAreas;
 }
Exemple #28
0
 public GatePayment(ICompositeKey <GatePayment> id, string name, decimal amount,
                    DateTimeOffset paidDateTime, ExtraData extraData = null) : base(id, name, extraData)
 {
     Amount       = amount;
     PaidDateTime = paidDateTime;
 }