public override TResult GetLookupKeys <TResult>(MemberInfo decoratedMember, IEnumerable <KeyValuePair <MemberInfo, object> > lookupValues, Func <IEnumerable <IRefAst>, TResult> onLookupValuesMatch, Func <string, TResult> onNoMatch) { if (lookupValues.Count() != 1) { return(onNoMatch($"{nameof(IdLookupAttribute)} only supports operations on a single member.")); } var lookupValue = lookupValues.Single(); var rowKeyValue = lookupValue.Value; var propertyValueType = lookupValue.Key.GetMemberType(); var rowKey = RowKey(this.GetType(), propertyValueType, rowKeyValue); if (rowKey.IsDefaultNullOrEmpty()) { return(onLookupValuesMatch(Enumerable.Empty <IRefAst>())); } var partitionKey = GetPartitionKey(rowKey); var astRef = new RefAst(rowKey, partitionKey); return(onLookupValuesMatch(astRef.AsEnumerable())); }
public bool TryGetIntegrationKey(string integrationId, MemberInfo key, object value, out IRefAst astLookup) { var integrationKey = (string)value; if (integrationKey.IsNullOrWhiteSpace()) { astLookup = default; return(false); } var integrationKeyHashInt = integrationKey.GetBytes().HashXX64(); var integrationKeyHash = integrationKeyHashInt.ToString("X").Substring(0, (int)this.Characters); var partitionKey = integrationId + integrationKeyHash; astLookup = new RefAst(integrationKey, partitionKey); return(true); }