Esempio n. 1
0
 public PartitionInfo(
     string partitionKeyPrefix,
     Expression <Func <TObject, object> > partitionKeySegmentsExpression,
     IReadOnlyDictionary <Type, IEntityKeySegmentResolver> partitionKeySegmentResolvers = null)
 {
     PartitionKey = new EntityKeyInfo <TObject>(partitionKeyPrefix, partitionKeySegmentsExpression, partitionKeySegmentResolvers);
     Rows         = new List <RowInfo <TObject> >();
 }
Esempio n. 2
0
        public RowInfo <TObject> Row(
            string rowKeyPrefix,
            Expression <Func <TObject, object> > rowKeySegmentsExpression,
            Expression <Func <TObject, object> > propertiesExpression,
            IReadOnlyDictionary <Type, IEntityKeySegmentResolver> rowKeySegmentResolvers = null,
            IReadOnlyDictionary <Type, IEntityPropertyResolver> propertyResolvers        = null)
        {
            var rowKey     = new EntityKeyInfo <TObject>(rowKeyPrefix, rowKeySegmentsExpression, rowKeySegmentResolvers);
            var properties = new EntityPropertiesInfo <TObject>(propertiesExpression, propertyResolvers);
            var entityInfo = new RowInfo <TObject>(PartitionKey, rowKey, properties);

            Rows.Add(entityInfo);
            return(entityInfo);
        }
Esempio n. 3
0
        private static bool DoesKeyInfoMatchKey <TObject>(EntityKeyInfo <TObject> keyInfo, string key)
        {
            if (keyInfo.KeyPrefix == null)
            {
                if (key.StartsWith(EntityKeyInfo.Separator))
                {
                    return(false);
                }
            }
            else
            {
                if (!key.StartsWith($"{keyInfo.KeyPrefix}{EntityKeyInfo.Separator}"))
                {
                    return(false);
                }
            }

            return(true);
        }