Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Mar 30, 2021
2 parents 8d9bb56 + b57f28f commit ba3aeed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Signum.Test/LinqProvider/WhereTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void WhereCombineConvert()
{
var query = Database.Query<AlbumEntity>().Where(a => ("C" + a.Id) + "B" == "C1B").Select(a => a.Id);

Assert.Equal(1, new Regex("CONCAT").Matches(query.QueryText()).Count);
Assert.Single(new Regex("CONCAT").Matches(query.QueryText()));

query.ToList();
}
Expand Down
2 changes: 1 addition & 1 deletion Signum.Utilities/DataStructures/DirectedEdgedGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public IEnumerable<KeyValuePair<T, E>> InverseRelatedTo(T node)
{
foreach (var item in adjacency)
{
if (item.Value.TryGetValue(node, out E edge))
if (item.Value.TryGetValue(node, out E? edge))
yield return KeyValuePair.Create(item.Key, edge);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Signum.Utilities/DataStructures/ScopedDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public string ToString(Func<TKey, string> keyRenderer, Func<TValue, string> valu

public TValue GetOrCreate(TKey key, Func<TValue> valueFactory)
{
if (!TryGetValue(key, out TValue result))
if (!TryGetValue(key, out TValue? result))
{
result = valueFactory();
Add(key, result);
Expand Down
14 changes: 7 additions & 7 deletions Signum.Utilities/Extensions/DictionaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key)
where K : notnull
where V : new()
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
{
result = new V();
dictionary.Add(key, result);
Expand All @@ -75,7 +75,7 @@ public static V GetOrAdd<K, V>(this ConcurrentDictionary<K, V> dictionary, K key
public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key, V value)
where K : notnull
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
{
result = value;
dictionary.Add(key, result);
Expand All @@ -86,7 +86,7 @@ public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key, V va
public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key, Func<V> generator)
where K : notnull
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
{
result = generator();
dictionary.Add(key, result);
Expand All @@ -97,7 +97,7 @@ public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key, Func
public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key, Func<K, V> generator)
where K : notnull
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
{
result = generator(key);
dictionary.Add(key, result);
Expand All @@ -108,23 +108,23 @@ public static V GetOrCreate<K, V>(this IDictionary<K, V> dictionary, K key, Func
public static V GetOrThrow<K, V>(this IDictionary<K, V> dictionary, K key, Func<K, Exception> exception)
where K : notnull
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
throw exception(key);
return result;
}

public static V GetOrThrow<K, V>(this IDictionary<K, V> dictionary, K key, string messageWithFormat)
where K : notnull
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
throw new KeyNotFoundException(messageWithFormat.FormatWith(key));
return result;
}

public static V GetOrThrow<K, V>(this IDictionary<K, V> dictionary, K key)
where K : notnull
{
if (!dictionary.TryGetValue(key, out V result))
if (!dictionary.TryGetValue(key, out V? result))
throw new KeyNotFoundException("Key '{0}' ({1}) not found on {2}".FormatWith(key, key.GetType().TypeName(), dictionary.GetType().TypeName()));
return result;
}
Expand Down

0 comments on commit ba3aeed

Please sign in to comment.