Skip to content
Browse files

Release 0.6.3

  • Loading branch information...
1 parent 9a31683 commit 28804298f7aebedbc72538f511460edfdac3545a @markrendle committed
Showing with 989 additions and 921 deletions.
  1. +37 −28 Simple.Data.Ado/CommandBuilder.cs
  2. +36 −28 Simple.Data.Ado/CommandTemplate.cs
  3. 0 Simple.Data.Ado/{DelegatingConnectionBase`1.cs → DelegatingConnectionBase1.cs}
  4. +256 −256 Simple.Data.Ado/{OptimizedDictionary`2.cs → OptimizedDictionary2.cs}
  5. +2 −2 Simple.Data.Ado/Simple.Data.Ado.csproj
  6. +2 −2 Simple.Data.Ado/Simple.Data.Ado.nuspec
  7. +2 −2 Simple.Data.Mocking/Simple.Data.Mocking.nuspec
  8. +2 −2 Simple.Data.SqlCe40/Simple.Data.SqlCe40.nuspec
  9. +2 −2 Simple.Data.SqlServer/Simple.Data.SqlServer.nuspec
  10. +6 −0 Simple.Data.SqlTest/DbImage.cs
  11. +15 −0 Simple.Data.SqlTest/InsertTests.cs
  12. +11 −1 Simple.Data.SqlTest/Resources/DatabaseReset.txt
  13. +22 −0 Simple.Data.SqlTest/UpdateTests.cs
  14. +1 −1 Simple.Data.TestHelper/DatabaseInternalsEx.cs
  15. +1 −1 Simple.Data.TestHelper/DatabaseSchemaTestsBase.cs
  16. BIN Simple.Data.sln.docstates
  17. +205 −205 Simple.Data/{BufferedEnumerable`1.cs → BufferedEnumerable1.cs}
  18. +1 −1 Simple.Data/Commands/AllCommand.cs
  19. +2 −2 Simple.Data/Commands/FindAllByCommand.cs
  20. +1 −1 Simple.Data/Commands/FindAllCommand.cs
  21. +1 −1 Simple.Data/Commands/FindByCommand.cs
  22. +1 −1 Simple.Data/Commands/QueryByCommand.cs
  23. +1 −1 Simple.Data/Commands/UpdateCommand.cs
  24. +2 −4 Simple.Data/DataStrategy.cs
  25. +1 −1 Simple.Data/Database.cs
  26. +177 −177 Simple.Data/{Maybe`1.cs → Maybe.cs}
  27. +103 −103 Simple.Data/{Range`1.cs → Range1.cs}
  28. +4 −4 Simple.Data/Simple.Data.csproj
  29. +1 −1 Simple.Data/Simple.Data.nuspec
  30. +91 −91 Simple.Data/{SimpleRecord.Dictionary`2.cs → SimpleRecord.Dictionary2.cs}
  31. +1 −1 Simple.Data/SimpleRecord.cs
  32. +2 −2 Simple.Data/SimpleTransaction.cs
View
65 Simple.Data.Ado/CommandBuilder.cs
@@ -109,50 +109,59 @@ private void SetParameters(IDbCommand command)
private static IEnumerable<IDbDataParameter> CreateParameterComplex(ParameterTemplate template, object value, IDbCommand command)
{
- var str = value as string;
- if (str != null)
+ if (template.DbType == DbType.Binary)
{
yield return CreateSingleParameter(value, command, template.Name, template.DbType);
}
else
{
- var range = value as IRange;
- if (range != null)
+ var str = value as string;
+ if (str != null)
{
- yield return CreateSingleParameter(range.Start, command, template.Name + "_start", template.DbType);
- yield return CreateSingleParameter(range.End, command, template.Name + "_end", template.DbType);
- SetBetweenInCommandText(command, template.Name);
+ yield return CreateSingleParameter(value, command, template.Name, template.DbType);
}
else
{
- var list = value as IEnumerable;
- if (list != null)
+ var range = value as IRange;
+ if (range != null)
{
- var builder = new StringBuilder();
- var array = list.Cast<object>().ToArray();
- for (int i = 0; i < array.Length; i++)
- {
- builder.AppendFormat(",{0}_{1}", template.Name, i);
- yield return
- CreateSingleParameter(array[i], command, template.Name + "_" + i, template.DbType);
- }
- if (command.CommandText.Contains("!= " + template.Name))
+ yield return
+ CreateSingleParameter(range.Start, command, template.Name + "_start", template.DbType);
+ yield return CreateSingleParameter(range.End, command, template.Name + "_end", template.DbType);
+ SetBetweenInCommandText(command, template.Name);
+ }
+ else
+ {
+ var list = value as IEnumerable;
+ if (list != null)
{
- command.CommandText = command.CommandText.Replace("!= " + template.Name,
- "NOT IN (" +
- builder.ToString().Substring(1) + ")");
+ var builder = new StringBuilder();
+ var array = list.Cast<object>().ToArray();
+ for (int i = 0; i < array.Length; i++)
+ {
+ builder.AppendFormat(",{0}_{1}", template.Name, i);
+ yield return
+ CreateSingleParameter(array[i], command, template.Name + "_" + i, template.DbType);
+ }
+ if (command.CommandText.Contains("!= " + template.Name))
+ {
+ command.CommandText = command.CommandText.Replace("!= " + template.Name,
+ "NOT IN (" +
+ builder.ToString().Substring(1) + ")");
+ }
+ else
+ {
+ command.CommandText = command.CommandText.Replace("= " + template.Name,
+ "IN (" +
+ builder.ToString().Substring(1) +
+ ")");
+ }
}
else
{
- command.CommandText = command.CommandText.Replace("= " + template.Name,
- "IN (" + builder.ToString().Substring(1) +
- ")");
+ yield return CreateSingleParameter(value, command, template.Name, template.DbType);
}
}
- else
- {
- yield return CreateSingleParameter(value, command, template.Name, template.DbType);
- }
}
}
}
View
64 Simple.Data.Ado/CommandTemplate.cs
@@ -46,50 +46,58 @@ private IEnumerable<IDbDataParameter> CreateParameters(IDbCommand command, IEnum
private static IEnumerable<IDbDataParameter> CreateParameters(IDbCommand command, ParameterTemplate parameterTemplate, object value)
{
- var str = value as string;
- if (str != null)
+ if (parameterTemplate.DbType == DbType.Binary)
{
yield return CreateParameter(command, parameterTemplate, value);
}
else
{
- var range = value as IRange;
- if (range != null)
+ var str = value as string;
+ if (str != null)
{
- yield return CreateParameter(command, parameterTemplate, range.Start, "_start");
- yield return CreateParameter(command, parameterTemplate, range.End, "_end");
- CommandBuilder.SetBetweenInCommandText(command, parameterTemplate.Name);
+ yield return CreateParameter(command, parameterTemplate, value);
}
else
{
- var list = value as IEnumerable;
- if (list != null)
+ var range = value as IRange;
+ if (range != null)
{
- var builder = new StringBuilder();
- var array = list.Cast<object>().ToArray();
- for (int i = 0; i < array.Length; i++)
- {
- builder.AppendFormat(",{0}_{1}", parameterTemplate.Name, i);
- yield return CreateParameter(command, parameterTemplate, array[i], "_" + i);
- }
- if (command.CommandText.Contains("!= " + parameterTemplate.Name))
+ yield return CreateParameter(command, parameterTemplate, range.Start, "_start");
+ yield return CreateParameter(command, parameterTemplate, range.End, "_end");
+ CommandBuilder.SetBetweenInCommandText(command, parameterTemplate.Name);
+ }
+ else
+ {
+ var list = value as IEnumerable;
+ if (list != null)
{
- command.CommandText = command.CommandText.Replace("!= " + parameterTemplate.Name,
- "NOT IN (" +
- builder.ToString().Substring(1) +
- ")");
+ var builder = new StringBuilder();
+ var array = list.Cast<object>().ToArray();
+ for (int i = 0; i < array.Length; i++)
+ {
+ builder.AppendFormat(",{0}_{1}", parameterTemplate.Name, i);
+ yield return CreateParameter(command, parameterTemplate, array[i], "_" + i);
+ }
+ if (command.CommandText.Contains("!= " + parameterTemplate.Name))
+ {
+ command.CommandText = command.CommandText.Replace("!= " + parameterTemplate.Name,
+ "NOT IN (" +
+ builder.ToString().Substring(1) +
+ ")");
+ }
+ else
+ {
+ command.CommandText = command.CommandText.Replace("= " + parameterTemplate.Name,
+ "IN (" +
+ builder.ToString().Substring(1) +
+ ")");
+ }
}
else
{
- command.CommandText = command.CommandText.Replace("= " + parameterTemplate.Name,
- "IN (" + builder.ToString().Substring(1) +
- ")");
+ yield return CreateParameter(command, parameterTemplate, value);
}
}
- else
- {
- yield return CreateParameter(command, parameterTemplate, value);
- }
}
}
}
View
0 ...le.Data.Ado/DelegatingConnectionBase`1.cs → Simple.Data.Ado/DelegatingConnectionBase1.cs
File renamed without changes.
View
512 Simple.Data.Ado/OptimizedDictionary`2.cs → Simple.Data.Ado/OptimizedDictionary2.cs
@@ -1,256 +1,256 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Simple.Data.Ado
-{
- public class OptimizedDictionary<TKey,TValue> : IDictionary<TKey,TValue>
- {
- private readonly IDictionary<TKey,int> _index;
- private readonly List<TValue> _values;
-
- public OptimizedDictionary(IDictionary<TKey, int> index, IEnumerable<TValue> values)
- {
- _index = index;
- _values = values.ToList();
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through the collection.
- /// </summary>
- /// <returns>
- /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
- /// </returns>
- /// <filterpriority>1</filterpriority>
- public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
- {
- return Enumerable().GetEnumerator();
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through a collection.
- /// </summary>
- /// <returns>
- /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- private IEnumerable<KeyValuePair<TKey,TValue>> Enumerable()
- {
- return Keys.Select(key => new KeyValuePair<TKey, TValue>(key, this[key]));
- }
-
- /// <summary>
- /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
- /// </summary>
- /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
- public void Add(KeyValuePair<TKey, TValue> item)
- {
- if (!_index.ContainsKey(item.Key))
- {
- AddKeyToIndex(item.Key);
- }
- _values[_index[item.Key]] = item.Value;
- }
-
- private void AddKeyToIndex(TKey key)
- {
- lock (_index.GetLockObject())
- {
- if (!_index.ContainsKey(key))
- {
- _index.Add(key, _index.Count);
- }
- }
- }
-
- /// <summary>
- /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
- /// </summary>
- /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only. </exception>
- public void Clear()
- {
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"/> contains a specific value.
- /// </summary>
- /// <returns>
- /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
- /// </returns>
- /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
- public bool Contains(KeyValuePair<TKey, TValue> item)
- {
- return Equals(_values[_index[item.Key]], item.Value);
- }
-
- /// <summary>
- /// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
- /// </summary>
- /// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.ICollection`1"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param><param name="arrayIndex">The zero-based index in <paramref name="array"/> at which copying begins.</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than 0.</exception><exception cref="T:System.ArgumentException"><paramref name="array"/> is multidimensional.-or-The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1"/> is greater than the available space from <paramref name="arrayIndex"/> to the end of the destination <paramref name="array"/>.</exception>
- public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
- {
- foreach (var key in _index.Keys)
- {
- int index = arrayIndex + _index[key];
- array[index] = new KeyValuePair<TKey, TValue>(key, _values[index]);
- }
- }
-
- /// <summary>
- /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
- /// </summary>
- /// <returns>
- /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
- /// </returns>
- /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
- public bool Remove(KeyValuePair<TKey, TValue> item)
- {
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>.
- /// </summary>
- /// <returns>
- /// The number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>.
- /// </returns>
- public int Count
- {
- get { return _values.Count; }
- }
-
- /// <summary>
- /// Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
- /// </summary>
- /// <returns>
- /// true if the <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only; otherwise, false.
- /// </returns>
- public bool IsReadOnly
- {
- get { return true; }
- }
-
- /// <summary>
- /// Determines whether the <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the specified key.
- /// </summary>
- /// <returns>
- /// true if the <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the key; otherwise, false.
- /// </returns>
- /// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception>
- public bool ContainsKey(TKey key)
- {
- return _index.ContainsKey(key);
- }
-
- /// <summary>
- /// Adds an element with the provided key and value to the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </summary>
- /// <param name="key">The object to use as the key of the element to add.</param><param name="value">The object to use as the value of the element to add.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception><exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.</exception><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.</exception>
- public void Add(TKey key, TValue value)
- {
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Removes the element with the specified key from the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </summary>
- /// <returns>
- /// true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key"/> was not found in the original <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </returns>
- /// <param name="key">The key of the element to remove.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.</exception>
- public bool Remove(TKey key)
- {
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Gets the value associated with the specified key.
- /// </summary>
- /// <returns>
- /// true if the object that implements <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the specified key; otherwise, false.
- /// </returns>
- /// <param name="key">The key whose value to get.</param><param name="value">When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the <paramref name="value"/> parameter. This parameter is passed uninitialized.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception>
- public bool TryGetValue(TKey key, out TValue value)
- {
- int index;
- if (!_index.TryGetValue(key, out index))
- {
- value = default(TValue);
- return false;
- }
- value = _values[index];
- return true;
- }
-
- /// <summary>
- /// Gets or sets the element with the specified key.
- /// </summary>
- /// <returns>
- /// The element with the specified key.
- /// </returns>
- /// <param name="key">The key of the element to get or set.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception><exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key"/> is not found.</exception><exception cref="T:System.NotSupportedException">The property is set and the <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.</exception>
- public TValue this[TKey key]
- {
- get
- {
- // Rethrow exceptions from here to hide implementation details.
- try
- {
- return _values[_index[key]];
- }
- catch (ArgumentNullException)
- {
- throw new ArgumentNullException("key");
- }
- catch (KeyNotFoundException)
- {
- throw new KeyNotFoundException();
- }
- }
- set
- {
- try
- {
- _values[_index[key]] = value;
- }
- catch (ArgumentNullException)
- {
- throw new ArgumentNullException("key");
- }
- catch (KeyNotFoundException)
- {
- throw new KeyNotFoundException();
- }
- }
- }
-
- /// <summary>
- /// Gets an <see cref="T:System.Collections.Generic.ICollection`1"/> containing the keys of the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </summary>
- /// <returns>
- /// An <see cref="T:System.Collections.Generic.ICollection`1"/> containing the keys of the object that implements <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </returns>
- public ICollection<TKey> Keys
- {
- get { return _index.Keys.ToArray(); }
- }
-
- /// <summary>
- /// Gets an <see cref="T:System.Collections.Generic.ICollection`1"/> containing the values in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </summary>
- /// <returns>
- /// An <see cref="T:System.Collections.Generic.ICollection`1"/> containing the values in the object that implements <see cref="T:System.Collections.Generic.IDictionary`2"/>.
- /// </returns>
- public ICollection<TValue> Values
- {
- get { return _values.ToArray(); }
- }
- }
-}
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Simple.Data.Ado
+{
+ public class OptimizedDictionary<TKey,TValue> : IDictionary<TKey,TValue>
+ {
+ private readonly IDictionary<TKey,int> _index;
+ private readonly List<TValue> _values;
+
+ public OptimizedDictionary(IDictionary<TKey, int> index, IEnumerable<TValue> values)
+ {
+ _index = index;
+ _values = values.ToList();
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the collection.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
+ /// </returns>
+ /// <filterpriority>1</filterpriority>
+ public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
+ {
+ return Enumerable().GetEnumerator();
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through a collection.
+ /// </summary>
+ /// <returns>
+ /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
+ /// </returns>
+ /// <filterpriority>2</filterpriority>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ private IEnumerable<KeyValuePair<TKey,TValue>> Enumerable()
+ {
+ return Keys.Select(key => new KeyValuePair<TKey, TValue>(key, this[key]));
+ }
+
+ /// <summary>
+ /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
+ /// </summary>
+ /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
+ public void Add(KeyValuePair<TKey, TValue> item)
+ {
+ if (!_index.ContainsKey(item.Key))
+ {
+ AddKeyToIndex(item.Key);
+ }
+ _values[_index[item.Key]] = item.Value;
+ }
+
+ private void AddKeyToIndex(TKey key)
+ {
+ lock (_index.GetLockObject())
+ {
+ if (!_index.ContainsKey(key))
+ {
+ _index.Add(key, _index.Count);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
+ /// </summary>
+ /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only. </exception>
+ public void Clear()
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"/> contains a specific value.
+ /// </summary>
+ /// <returns>
+ /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
+ /// </returns>
+ /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
+ public bool Contains(KeyValuePair<TKey, TValue> item)
+ {
+ return Equals(_values[_index[item.Key]], item.Value);
+ }
+
+ /// <summary>
+ /// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
+ /// </summary>
+ /// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.Generic.ICollection`1"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param><param name="arrayIndex">The zero-based index in <paramref name="array"/> at which copying begins.</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than 0.</exception><exception cref="T:System.ArgumentException"><paramref name="array"/> is multidimensional.-or-The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1"/> is greater than the available space from <paramref name="arrayIndex"/> to the end of the destination <paramref name="array"/>.</exception>
+ public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
+ {
+ foreach (var key in _index.Keys)
+ {
+ int index = arrayIndex + _index[key];
+ array[index] = new KeyValuePair<TKey, TValue>(key, _values[index]);
+ }
+ }
+
+ /// <summary>
+ /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
+ /// </summary>
+ /// <returns>
+ /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
+ /// </returns>
+ /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
+ public bool Remove(KeyValuePair<TKey, TValue> item)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>.
+ /// </summary>
+ /// <returns>
+ /// The number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>.
+ /// </returns>
+ public int Count
+ {
+ get { return _values.Count; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
+ /// </summary>
+ /// <returns>
+ /// true if the <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only; otherwise, false.
+ /// </returns>
+ public bool IsReadOnly
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// Determines whether the <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the specified key.
+ /// </summary>
+ /// <returns>
+ /// true if the <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the key; otherwise, false.
+ /// </returns>
+ /// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception>
+ public bool ContainsKey(TKey key)
+ {
+ return _index.ContainsKey(key);
+ }
+
+ /// <summary>
+ /// Adds an element with the provided key and value to the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </summary>
+ /// <param name="key">The object to use as the key of the element to add.</param><param name="value">The object to use as the value of the element to add.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception><exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.</exception><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.</exception>
+ public void Add(TKey key, TValue value)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Removes the element with the specified key from the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </summary>
+ /// <returns>
+ /// true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key"/> was not found in the original <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </returns>
+ /// <param name="key">The key of the element to remove.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.</exception>
+ public bool Remove(TKey key)
+ {
+ throw new NotSupportedException();
+ }
+
+ /// <summary>
+ /// Gets the value associated with the specified key.
+ /// </summary>
+ /// <returns>
+ /// true if the object that implements <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the specified key; otherwise, false.
+ /// </returns>
+ /// <param name="key">The key whose value to get.</param><param name="value">When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the <paramref name="value"/> parameter. This parameter is passed uninitialized.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception>
+ public bool TryGetValue(TKey key, out TValue value)
+ {
+ int index;
+ if (!_index.TryGetValue(key, out index))
+ {
+ value = default(TValue);
+ return false;
+ }
+ value = _values[index];
+ return true;
+ }
+
+ /// <summary>
+ /// Gets or sets the element with the specified key.
+ /// </summary>
+ /// <returns>
+ /// The element with the specified key.
+ /// </returns>
+ /// <param name="key">The key of the element to get or set.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception><exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key"/> is not found.</exception><exception cref="T:System.NotSupportedException">The property is set and the <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.</exception>
+ public TValue this[TKey key]
+ {
+ get
+ {
+ // Rethrow exceptions from here to hide implementation details.
+ try
+ {
+ return _values[_index[key]];
+ }
+ catch (ArgumentNullException)
+ {
+ throw new ArgumentNullException("key");
+ }
+ catch (KeyNotFoundException)
+ {
+ throw new KeyNotFoundException();
+ }
+ }
+ set
+ {
+ try
+ {
+ _values[_index[key]] = value;
+ }
+ catch (ArgumentNullException)
+ {
+ throw new ArgumentNullException("key");
+ }
+ catch (KeyNotFoundException)
+ {
+ throw new KeyNotFoundException();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets an <see cref="T:System.Collections.Generic.ICollection`1"/> containing the keys of the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </summary>
+ /// <returns>
+ /// An <see cref="T:System.Collections.Generic.ICollection`1"/> containing the keys of the object that implements <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </returns>
+ public ICollection<TKey> Keys
+ {
+ get { return _index.Keys.ToArray(); }
+ }
+
+ /// <summary>
+ /// Gets an <see cref="T:System.Collections.Generic.ICollection`1"/> containing the values in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </summary>
+ /// <returns>
+ /// An <see cref="T:System.Collections.Generic.ICollection`1"/> containing the values in the object that implements <see cref="T:System.Collections.Generic.IDictionary`2"/>.
+ /// </returns>
+ public ICollection<TValue> Values
+ {
+ get { return _values.ToArray(); }
+ }
+ }
+}
View
4 Simple.Data.Ado/Simple.Data.Ado.csproj
@@ -67,7 +67,7 @@
<Compile Include="DataRecordExtensions.cs" />
<Compile Include="DbCommandExtensions.cs" />
<Compile Include="DbConnectionExtensions.cs" />
- <Compile Include="DelegatingConnectionBase`1.cs" />
+ <Compile Include="DelegatingConnectionBase1.cs" />
<Compile Include="DeleteHelper.cs" />
<Compile Include="DictionaryExtensions.cs" />
<Compile Include="ExpressionFormatter.cs" />
@@ -85,7 +85,7 @@
<Compile Include="JoinType.cs" />
<Compile Include="OptimizedDictionary.cs" />
<Compile Include="OptimizedDictionaryIndex.cs" />
- <Compile Include="OptimizedDictionary`2.cs" />
+ <Compile Include="OptimizedDictionary2.cs" />
<Compile Include="ParameterTemplate.cs" />
<Compile Include="ProcedureExecutor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
View
4 Simple.Data.Ado/Simple.Data.Ado.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Simple.Data.Ado</id>
- <version>0.6.2</version>
+ <version>0.6.3</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<description>ADO Adapter for the Simple.Data data access library.</description>
@@ -12,7 +12,7 @@
<tags>sqlserver database data ado .net40</tags>
<language>en-us</language>
<dependencies>
- <dependency id="Simple.Data.Core" version="0.6.2" />
+ <dependency id="Simple.Data.Core" version="0.6.3" />
</dependencies>
</metadata>
</package>
View
4 Simple.Data.Mocking/Simple.Data.Mocking.nuspec
@@ -2,7 +2,7 @@
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.Data.Mocking</id>
- <version>0.6.2</version>
+ <version>0.6.3</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<description>XML-based Mocking adapter for the Simple.Data data access library.</description>
@@ -12,7 +12,7 @@
<tags>database data .net40</tags>
<language>en-us</language>
<dependencies>
- <dependency id="Simple.Data.Ado" version="0.6.2" />
+ <dependency id="Simple.Data.Ado" version="0.6.3" />
</dependencies>
</metadata>
</package>
View
4 Simple.Data.SqlCe40/Simple.Data.SqlCe40.nuspec
@@ -2,7 +2,7 @@
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.Data.SqlCompact40</id>
- <version>0.6.2</version>
+ <version>0.6.3</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<description>SQL Server Compact 4.0 ADO provider for the Simple.Data data access library.</description>
@@ -12,7 +12,7 @@
<tags>sqlserver compact sqlce database data ado .net40</tags>
<language>en-us</language>
<dependencies>
- <dependency id="Simple.Data.Ado" version="0.6.2" />
+ <dependency id="Simple.Data.Ado" version="0.6.3" />
</dependencies>
</metadata>
</package>
View
4 Simple.Data.SqlServer/Simple.Data.SqlServer.nuspec
@@ -2,7 +2,7 @@
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.Data.SqlServer</id>
- <version>0.6.2</version>
+ <version>0.6.3</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<description>SQL Server ADO provider for the Simple.Data data access library.</description>
@@ -12,7 +12,7 @@
<tags>sqlserver database data ado .net40</tags>
<language>en-us</language>
<dependencies>
- <dependency id="Simple.Data.Ado" version="0.6.2" />
+ <dependency id="Simple.Data.Ado" version="0.6.3" />
</dependencies>
</metadata>
</package>
View
6 Simple.Data.SqlTest/DbImage.cs
@@ -4,4 +4,10 @@ public class DbImage
{
public byte[] TheImage { get; set; }
}
+
+ public class Blob
+ {
+ public int Id { get; set; }
+ public byte[] Data { get; set; }
+ }
}
View
15 Simple.Data.SqlTest/InsertTests.cs
@@ -79,5 +79,20 @@ public void TestWithImageColumn()
db.Images.DeleteById(1);
}
}
+
+ [Test]
+ public void TestInsertWithVarBinaryMaxColumn()
+ {
+ var db = DatabaseHelper.Open();
+ var image = GetImage.Image;
+ var blob = new Blob
+ {
+ Id = 1,
+ Data = image
+ };
+ db.Blobs.Insert(blob);
+ blob = db.Blobs.FindById(1);
+ Assert.IsTrue(image.SequenceEqual(blob.Data));
+ }
}
}
View
12 Simple.Data.SqlTest/Resources/DatabaseReset.txt
@@ -38,6 +38,8 @@ BEGIN
DROP TABLE [dbo].[PagingTest];
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Images]') AND type in (N'U'))
DROP TABLE [dbo].[Images];
+ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Blobs]') AND type in (N'U'))
+ DROP TABLE [dbo].[Blobs]
CREATE TABLE [dbo].[Users] (
[Id] INT IDENTITY (1, 1) NOT NULL,
@@ -96,7 +98,15 @@ BEGIN
ADD CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED ([CustomerId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);
CREATE TABLE [dbo].[PagingTest] ([Id] int not null);
-
+
+ CREATE TABLE [dbo].[Blobs](
+ [Id] [int] NOT NULL,
+ [Data] [varbinary](max) NULL
+ )
+
+ ALTER TABLE [dbo].[Blobs]
+ ADD CONSTRAINT [PK_Blobs] PRIMARY KEY CLUSTERED ([Id] ASC)
+
BEGIN TRANSACTION
SET IDENTITY_INSERT [dbo].[Customers] ON
INSERT INTO [dbo].[Customers] ([CustomerId], [Name], [Address]) VALUES (1, N'Test', N'100 Road')
View
22 Simple.Data.SqlTest/UpdateTests.cs
@@ -1,5 +1,7 @@
using System.Dynamic;
+using System.Linq;
using NUnit.Framework;
+using Simple.Data.SqlTest.Resources;
namespace Simple.Data.SqlTest
{
@@ -62,5 +64,25 @@ public void TestUpdateWithDynamicTypeObject()
Assert.AreEqual("diodes", actual.Password);
Assert.AreEqual(42000000, actual.Age);
}
+
+ [Test]
+ public void TestUpdateWithVarBinaryMaxColumn()
+ {
+ var db = DatabaseHelper.Open();
+ var blob = new Blob
+ {
+ Id = 1,
+ Data = new byte[] {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+ };
+ db.Blobs.Insert(blob);
+
+ var newData = blob.Data = new byte[] {0,1,2,3,4,5,6,7,8,9};
+
+ db.Blobs.Update(blob);
+
+ blob = db.Blobs.FindById(1);
+
+ Assert.IsTrue(newData.SequenceEqual(blob.Data));
+ }
}
}
View
2 Simple.Data.TestHelper/DatabaseInternalsEx.cs
@@ -9,7 +9,7 @@ public static class DatabaseInternalsEx
{
public static Adapter GetAdapter(this Database database)
{
- return database.Adapter;
+ return database.GetAdapter();
}
}
}
View
2 Simple.Data.TestHelper/DatabaseSchemaTestsBase.cs
@@ -15,7 +15,7 @@ public abstract class DatabaseSchemaTestsBase
private DatabaseSchema GetSchema()
{
- var adapter = GetDatabase().Adapter as AdoAdapter;
+ var adapter = GetDatabase().GetAdapter() as AdoAdapter;
if (adapter == null) Assert.Fail("Expected an ADO-based database adapter.");
return adapter.GetSchema();
}
View
BIN Simple.Data.sln.docstates
Binary file not shown.
View
410 Simple.Data/BufferedEnumerable`1.cs → Simple.Data/BufferedEnumerable1.cs
@@ -1,205 +1,205 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace Simple.Data
-{
- sealed class BufferedEnumerable<T> : IEnumerable<T>
- {
- private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
- private readonly List<T> _buffer = new List<T>();
- private bool _done;
-
- internal void Iterate(Func<Maybe<T>> iterator)
- {
- Maybe<T> maybe;
- while ((maybe = iterator()).HasValue)
- {
- Add(maybe.Value);
- }
- SetDone();
- }
-
- private void SetDone()
- {
- _lock.EnterWriteLock();
- try
- {
- _done = true;
- }
- finally
- {
- _lock.ExitWriteLock();
- }
- }
-
- private void Add(T item)
- {
- _lock.EnterWriteLock();
- try
- {
- _buffer.Add(item);
- }
- finally
- {
- _lock.ExitWriteLock();
- }
- }
-
- private T this[int index]
- {
- get
- {
- _lock.EnterReadLock();
- try
- {
- return _buffer[index];
- }
- finally
- {
- _lock.ExitReadLock();
- }
- }
- }
-
- private int Count
- {
- get
- {
- _lock.EnterReadLock();
- try
- {
- return _buffer.Count;
- }
- finally
- {
- _lock.ExitReadLock();
- }
- }
- }
-
- private bool Done
- {
- get
- {
- _lock.EnterReadLock();
- try
- {
- return _done;
- }
- finally
- {
- _lock.ExitReadLock();
- }
- }
- }
-
- class BufferedEnumerator : IEnumerator<T>
- {
- private readonly BufferedEnumerable<T> _bufferedEnumerable;
-
- public BufferedEnumerator(BufferedEnumerable<T> bufferedEnumerable)
- {
- _bufferedEnumerable = bufferedEnumerable;
- }
-
- private int _current = -1;
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- /// <filterpriority>2</filterpriority>
- public void Dispose()
- {
-
- }
-
- /// <summary>
- /// Advances the enumerator to the next element of the collection.
- /// </summary>
- /// <returns>
- /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
- /// </returns>
- /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority>
- public bool MoveNext()
- {
- ++_current;
-
- if (_bufferedEnumerable._done)
- {
- return _current < _bufferedEnumerable.Count;
- }
-
- WaitForBuffer();
- return _current < _bufferedEnumerable.Count;
- }
-
- private void WaitForBuffer()
- {
- // Block until next item delivered or iterator is done.
- SpinWait.SpinUntil(() => _bufferedEnumerable.Done || _bufferedEnumerable.Count > _current);
- }
-
- /// <summary>
- /// Sets the enumerator to its initial position, which is before the first element in the collection.
- /// </summary>
- /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority>
- public void Reset()
- {
- _current = -1;
- }
-
- /// <summary>
- /// Gets the element in the collection at the current position of the enumerator.
- /// </summary>
- /// <returns>
- /// The element in the collection at the current position of the enumerator.
- /// </returns>
- public T Current
- {
- get
- {
- if (_current >= _bufferedEnumerable.Count) throw new InvalidOperationException();
- return _bufferedEnumerable[_current];
- }
- }
-
- /// <summary>
- /// Gets the current element in the collection.
- /// </summary>
- /// <returns>
- /// The current element in the collection.
- /// </returns>
- /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception><filterpriority>2</filterpriority>
- object IEnumerator.Current
- {
- get { return Current; }
- }
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through the collection.
- /// </summary>
- /// <returns>
- /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
- /// </returns>
- /// <filterpriority>1</filterpriority>
- public IEnumerator<T> GetEnumerator()
- {
- return new BufferedEnumerator(this);
- }
-
- /// <summary>
- /// Returns an enumerator that iterates through a collection.
- /// </summary>
- /// <returns>
- /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Simple.Data
+{
+ sealed class BufferedEnumerable<T> : IEnumerable<T>
+ {
+ private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
+ private readonly List<T> _buffer = new List<T>();
+ private bool _done;
+
+ internal void Iterate(Func<Maybe<T>> iterator)
+ {
+ Maybe<T> maybe;
+ while ((maybe = iterator()).HasValue)
+ {
+ Add(maybe.Value);
+ }
+ SetDone();
+ }
+
+ private void SetDone()
+ {
+ _lock.EnterWriteLock();
+ try
+ {
+ _done = true;
+ }
+ finally
+ {
+ _lock.ExitWriteLock();
+ }
+ }
+
+ private void Add(T item)
+ {
+ _lock.EnterWriteLock();
+ try
+ {
+ _buffer.Add(item);
+ }
+ finally
+ {
+ _lock.ExitWriteLock();
+ }
+ }
+
+ private T this[int index]
+ {
+ get
+ {
+ _lock.EnterReadLock();
+ try
+ {
+ return _buffer[index];
+ }
+ finally
+ {
+ _lock.ExitReadLock();
+ }
+ }
+ }
+
+ private int Count
+ {
+ get
+ {
+ _lock.EnterReadLock();
+ try
+ {
+ return _buffer.Count;
+ }
+ finally
+ {
+ _lock.ExitReadLock();
+ }
+ }
+ }
+
+ private bool Done
+ {
+ get
+ {
+ _lock.EnterReadLock();
+ try
+ {
+ return _done;
+ }
+ finally
+ {
+ _lock.ExitReadLock();
+ }
+ }
+ }
+
+ class BufferedEnumerator : IEnumerator<T>
+ {
+ private readonly BufferedEnumerable<T> _bufferedEnumerable;
+
+ public BufferedEnumerator(BufferedEnumerable<T> bufferedEnumerable)
+ {
+ _bufferedEnumerable = bufferedEnumerable;
+ }
+
+ private int _current = -1;
+
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
+ /// <filterpriority>2</filterpriority>
+ public void Dispose()
+ {
+
+ }
+
+ /// <summary>
+ /// Advances the enumerator to the next element of the collection.
+ /// </summary>
+ /// <returns>
+ /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
+ /// </returns>
+ /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority>
+ public bool MoveNext()
+ {
+ ++_current;
+
+ if (_bufferedEnumerable._done)
+ {
+ return _current < _bufferedEnumerable.Count;
+ }
+
+ WaitForBuffer();
+ return _current < _bufferedEnumerable.Count;
+ }
+
+ private void WaitForBuffer()
+ {
+ // Block until next item delivered or iterator is done.
+ SpinWait.SpinUntil(() => _bufferedEnumerable.Done || _bufferedEnumerable.Count > _current);
+ }
+
+ /// <summary>
+ /// Sets the enumerator to its initial position, which is before the first element in the collection.
+ /// </summary>
+ /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority>
+ public void Reset()
+ {
+ _current = -1;
+ }
+
+ /// <summary>
+ /// Gets the element in the collection at the current position of the enumerator.
+ /// </summary>
+ /// <returns>
+ /// The element in the collection at the current position of the enumerator.
+ /// </returns>
+ public T Current
+ {
+ get
+ {
+ if (_current >= _bufferedEnumerable.Count) throw new InvalidOperationException();
+ return _bufferedEnumerable[_current];
+ }
+ }
+
+ /// <summary>
+ /// Gets the current element in the collection.
+ /// </summary>
+ /// <returns>
+ /// The current element in the collection.
+ /// </returns>
+ /// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element.</exception><filterpriority>2</filterpriority>
+ object IEnumerator.Current
+ {
+ get { return Current; }
+ }
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the collection.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
+ /// </returns>
+ /// <filterpriority>1</filterpriority>
+ public IEnumerator<T> GetEnumerator()
+ {
+ return new BufferedEnumerator(this);
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through a collection.
+ /// </summary>
+ /// <returns>
+ /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
+ /// </returns>
+ /// <filterpriority>2</filterpriority>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
View
2 Simple.Data/Commands/AllCommand.cs
@@ -30,7 +30,7 @@ public bool IsCommandFor(string method)
/// <returns></returns>
public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
{
- return new SimpleQuery(dataStrategy.Adapter, table.GetQualifiedName());
+ return new SimpleQuery(dataStrategy.GetAdapter(), table.GetQualifiedName());
//return new SimpleResultSet(dataStrategy.Find(table.GetQualifiedName(), null)
// .Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy)));
}
View
4 Simple.Data/Commands/FindAllByCommand.cs
@@ -15,7 +15,7 @@ public bool IsCommandFor(string method)
public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
{
var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
- return new SimpleQuery(dataStrategy.Adapter, table.GetQualifiedName()).Where(criteria);
+ return new SimpleQuery(dataStrategy.GetAdapter(), table.GetQualifiedName()).Where(criteria);
//var data = dataStrategy.Find(table.GetQualifiedName(), criteria);
//return CreateSimpleResultSet(table, dataStrategy, data);
}
@@ -33,7 +33,7 @@ private static object CreateSimpleResultSet(DynamicTable table, DataStrategy dat
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
try
{
- var func = dataStrategy.Adapter.CreateFindDelegate(table.GetQualifiedName(), criteriaExpression);
+ var func = dataStrategy.GetAdapter().CreateFindDelegate(table.GetQualifiedName(), criteriaExpression);
return a => CreateSimpleResultSet(table, dataStrategy, func(a));
}
catch (NotImplementedException)
View
2 Simple.Data/Commands/FindAllCommand.cs
@@ -32,7 +32,7 @@ public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMembe
{
if (args.Length == 1 && args[0] is SimpleExpression)
{
- return new SimpleQuery(dataStrategy.Adapter, table.GetQualifiedName()).Where((SimpleExpression) args[0]);
+ return new SimpleQuery(dataStrategy.GetAdapter(), table.GetQualifiedName()).Where((SimpleExpression)args[0]);
}
return null;
View
2 Simple.Data/Commands/FindByCommand.cs
@@ -20,7 +20,7 @@ public bool IsCommandFor(string method)
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
try
{
- var func = dataStrategy.Adapter.CreateFindOneDelegate(table.GetQualifiedName(), criteriaExpression);
+ var func = dataStrategy.GetAdapter().CreateFindOneDelegate(table.GetQualifiedName(), criteriaExpression);
return a =>
{
var data = func(a);
View
2 Simple.Data/Commands/QueryByCommand.cs
@@ -23,7 +23,7 @@ public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMembe
private static object CreateSimpleQuery(DynamicTable table, InvokeMemberBinder binder, object[] args, DataStrategy dataStrategy)
{
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
- return new SimpleQuery(dataStrategy.Adapter, table.GetQualifiedName()).Where(criteriaExpression);
+ return new SimpleQuery(dataStrategy.GetAdapter(), table.GetQualifiedName()).Where(criteriaExpression);
}
}
}
View
2 Simple.Data/Commands/UpdateCommand.cs
@@ -18,7 +18,7 @@ public bool IsCommandFor(string method)
public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
{
if (args.Length != 1) throw new ArgumentException("Incorrect number of arguments to Update method.");
- var keyFieldNames = dataStrategy.Adapter.GetKeyFieldNames(table.GetQualifiedName()).ToArray();
+ var keyFieldNames = dataStrategy.GetAdapter().GetKeyFieldNames(table.GetQualifiedName()).ToArray();
if (keyFieldNames.Length == 0)
{
throw new NotSupportedException("Adapter does not support key-based update for this object.");
View
6 Simple.Data/DataStrategy.cs
@@ -15,9 +15,7 @@ public abstract class DataStrategy : DynamicObject
{
private readonly ConcurrentDictionary<string, dynamic> _members = new ConcurrentDictionary<string, dynamic>();
- public Adapter Adapter { get { return GetAdapter(); } }
-
- protected internal abstract Adapter GetAdapter();
+ public abstract Adapter GetAdapter();
/// <summary>
/// Provides the implementation for operations that get member values. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.
@@ -45,7 +43,7 @@ private dynamic GetOrAddDynamicReference(string name)
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
- var adapterWithFunctions = Adapter as IAdapterWithFunctions;
+ var adapterWithFunctions = GetAdapter() as IAdapterWithFunctions;
if (adapterWithFunctions != null && adapterWithFunctions.IsValidFunction(binder.Name))
{
var command = new ExecuteFunctionCommand(GetDatabase(), adapterWithFunctions, binder.Name,
View
2 Simple.Data/Database.cs
@@ -32,7 +32,7 @@ internal Database(Adapter adapter)
_adapter = adapter;
}
- protected internal override Adapter GetAdapter()
+ public override Adapter GetAdapter()
{
return _adapter;
}
View
354 Simple.Data/Maybe`1.cs → Simple.Data/Maybe.cs
@@ -1,177 +1,177 @@
-using System;
-
-namespace Simple.Data
-{
- public static class Maybe
- {
- public static Maybe<T> Some<T>(T value)
- {
- return Maybe<T>.Some(value);
- }
- }
- public abstract class Maybe<T> : IEquatable<Maybe<T>>
- {
- public static readonly Maybe<T> None = new NoneClass();
- public static Maybe<T> Some(T value)
- {
- return new SomeClass(value);
- }
-
- public abstract bool HasValue { get; }
-
- class NoneClass : Maybe<T>
- {
- public override T Value
- {
- get { return default(T); }
- }
-
- public override bool HasValue
- {
- get { return false; }
- }
-
- /// <summary>
- /// Indicates whether the current object is equal to another object of the same type.
- /// </summary>
- /// <returns>
- /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
- /// </returns>
- /// <param name="other">An object to compare with this object.</param>
- public override bool Equals(Maybe<T> other)
- {
- return other is NoneClass;
- }
-
- /// <summary>
- /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <returns>
- /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- public override string ToString()
- {
- return string.Empty;
- }
-
- /// <summary>
- /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <returns>
- /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
- /// </returns>
- /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
- public override bool Equals(object obj)
- {
- return obj is NoneClass;
- }
-
- public override int GetHashCode()
- {
- return 0;
- }
- }
-
- class SomeClass : Maybe<T>
- {
- private readonly T _value;
-
- public SomeClass(T value)
- {
- _value = value;
- }
-
- public override T Value
- {
- get { return _value; }
- }
-
- public override bool HasValue
- {
- get { return true; }
- }
-
- /// <summary>
- /// Indicates whether the current object is equal to another object of the same type.
- /// </summary>
- /// <returns>
- /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
- /// </returns>
- /// <param name="other">An object to compare with this object.</param>
- public override bool Equals(Maybe<T> other)
- {
- return other != null && other.HasValue && Equals(other.Value, _value);
- }
-
- /// <summary>
- /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <returns>
- /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- public override string ToString()
- {
- return _value.ToString();
- }
-
- /// <summary>
- /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <returns>
- /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
- /// </returns>
- /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
- public override bool Equals(object obj)
- {
- return Equals(obj as Maybe<T>);
- }
-
- public override int GetHashCode()
- {
- return _value.GetHashCode();
- }
- }
-
- public abstract T Value
- {
- get;
- }
-
- //public static implicit operator bool(Maybe<T> maybe)
- //{
- // return maybe is SomeClass;
- //}
-
- public static implicit operator Maybe<T>(T value)
- {
- return new SomeClass(value);
- }
-
- /// <summary>
- /// Indicates whether the current object is equal to another object of the same type.
- /// </summary>
- /// <returns>
- /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
- /// </returns>
- /// <param name="other">An object to compare with this object.</param>
- public abstract bool Equals(Maybe<T> other);
-
- public static bool operator ==(Maybe<T> left, Maybe<T> right)
- {
- return Equals(left, right);
- }
-
- public static bool operator !=(Maybe<T> left, Maybe<T> right)
- {
- return !Equals(left, right);
- }
-
- public abstract override bool Equals(object obj);
-
- public abstract override int GetHashCode();
-
- public abstract override string ToString();
- }
-}
+using System;
+
+namespace Simple.Data
+{
+ public static class Maybe
+ {
+ public static Maybe<T> Some<T>(T value)
+ {
+ return Maybe<T>.Some(value);
+ }
+ }
+ public abstract class Maybe<T> : IEquatable<Maybe<T>>
+ {
+ public static readonly Maybe<T> None = new NoneClass();
+ public static Maybe<T> Some(T value)
+ {
+ return new SomeClass(value);
+ }
+
+ public abstract bool HasValue { get; }
+
+ class NoneClass : Maybe<T>
+ {
+ public override T Value
+ {
+ get { return default(T); }
+ }
+
+ public override bool HasValue
+ {
+ get { return false; }
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object.</param>
+ public override bool Equals(Maybe<T> other)
+ {
+ return other is NoneClass;
+ }
+
+ /// <summary>
+ /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
+ /// </returns>
+ /// <filterpriority>2</filterpriority>
+ public override string ToString()
+ {
+ return string.Empty;
+ }
+
+ /// <summary>
+ /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
+ /// </summary>
+ /// <returns>
+ /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
+ /// </returns>
+ /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
+ public override bool Equals(object obj)
+ {
+ return obj is NoneClass;
+ }
+
+ public override int GetHashCode()
+ {
+ return 0;
+ }
+ }
+
+ class SomeClass : Maybe<T>
+ {
+ private readonly T _value;
+
+ public SomeClass(T value)
+ {
+ _value = value;
+ }
+
+ public override T Value
+ {
+ get { return _value; }
+ }
+
+ public override bool HasValue
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object.</param>
+ public override bool Equals(Maybe<T> other)
+ {
+ return other != null && other.HasValue && Equals(other.Value, _value);
+ }
+
+ /// <summary>
+ /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
+ /// </returns>
+ /// <filterpriority>2</filterpriority>
+ public override string ToString()
+ {
+ return _value.ToString();
+ }
+
+ /// <summary>
+ /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
+ /// </summary>
+ /// <returns>
+ /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
+ /// </returns>
+ /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
+ public override bool Equals(object obj)
+ {
+ return Equals(obj as Maybe<T>);
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+ }
+
+ public abstract T Value
+ {
+ get;
+ }
+
+ //public static implicit operator bool(Maybe<T> maybe)
+ //{
+ // return maybe is SomeClass;
+ //}
+
+ public static implicit operator Maybe<T>(T value)
+ {
+ return new SomeClass(value);
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object.</param>
+ public abstract bool Equals(Maybe<T> other);
+
+ public static bool operator ==(Maybe<T> left, Maybe<T> right)
+ {
+ return Equals(left, right);
+ }
+
+ public static bool operator !=(Maybe<T> left, Maybe<T> right)
+ {
+ return !Equals(left, right);
+ }
+
+ public abstract override bool Equals(object obj);
+
+ public abstract override int GetHashCode();
+
+ public abstract override string ToString();
+ }
+}
View
206 Simple.Data/Range`1.cs → Simple.Data/Range1.cs
@@ -1,103 +1,103 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Simple.Data
-{
- public struct Range<T> : IRange, IEquatable<Range<T>>
- where T : IComparable<T>
- {
- private readonly T _start;
- private readonly T _end;
-
- public Range(T start, T end)
- : this()
- {
- _start = start;
- _end = end;
- }
-
- public T End
- {
- get { return _end; }
- }
-
- public IEnumerable<object> AsEnumerable()
- {
- yield return _start;
- yield return _end;
- }
-
- public T Start
- {
- get { return _start; }
- }
-
- public override string ToString()
- {
- return string.Format("({0}..{1})", _start, _end);
- }
-
- /// <summary>
- /// Indicates whether the current object is equal to another object of the same type.
- /// </summary>
- /// <returns>
- /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
- /// </returns>
- /// <param name="other">An object to compare with this object.</param>
- public bool Equals(Range<T> other)
- {
- return Equals(other._start, _start) && Equals(other._end, _end);
- }
-
- /// <summary>
- /// Indicates whether this instance and a specified object are equal.
- /// </summary>
- /// <returns>
- /// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
- /// </returns>
- /// <param name="obj">Another object to compare to. </param><filterpriority>2</filterpriority>
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (obj.GetType() != typeof(Range<T>)) return false;
- return Equals((Range<T>)obj);
- }
-
- /// <summary>
- /// Returns the hash code for this instance.
- /// </summary>
- /// <returns>
- /// A 32-bit signed integer that is the hash code for this instance.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- public override int GetHashCode()
- {
- unchecked
- {
- return (_start.GetHashCode() * 397) ^ _end.GetHashCode();
- }
- }
-
- public static bool operator ==(Range<T> left, Range<T> right)
- {
- return left.Equals(right);
- }
-
- public static bool operator !=(Range<T> left, Range<T> right)
- {
- return !left.Equals(right);
- }
-
- object IRange.Start
- {
- get { return Start; }
- }
-
- object IRange.End
- {
- get { return End; }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Simple.Data
+{
+ public struct Range<T> : IRange, IEquatable<Range<T>>
+ where T : IComparable<T>
+ {
+ private readonly T _start;
+ private readonly T _end;
+
+ public Range(T start, T end)
+ : this()
+ {
+ _start = start;
+ _end = end;
+ }
+
+ public T End
+ {
+ get { return _end; }
+ }
+
+ public IEnumerable<object> AsEnumerable()
+ {
+ yield return _start;
+ yield return _end;
+ }
+
+ public T Start
+ {
+ get { return _start; }
+ }
+
+ public override string ToString()
+ {
+ return string.Format("({0}..{1})", _start, _end);
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object.</param>
+ public bool Equals(Range<T> other)
+ {
+ return Equals(other._start, _start) && Equals(other._end, _end);
+ }
+
+ /// <summary>
+ /// Indicates whether this instance and a specified object are equal.
+ /// </summary>
+ /// <returns>
+ /// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
+ /// </returns>
+ /// <param name="obj">Another object to compare to. </param><filterpriority>2</filterpriority>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (obj.GetType() != typeof(Range<T>)) return false;
+ return Equals((Range<T>)obj);
+ }
+
+ /// <summary>
+ /// Returns the hash code for this instance.
+ /// </summary>
+ /// <returns>
+ /// A 32-bit signed integer that is the hash code for this instance.
+ /// </returns>
+ /// <filterpriority>2</filterpriority>
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ return (_start.GetHashCode() * 397) ^ _end.GetHashCode();
+ }
+ }
+
+ public static bool operator ==(Range<T> left, Range<T> right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Range<T> left, Range<T> right)
+ {
+ return !left.Equals(right);
+ }
+
+ object IRange.Start
+ {
+ get { return Start; }
+ }
+
+ object IRange.End
+ {
+ get { return End; }
+ }
+ }
+}
View
8 Simple.Data/Simple.Data.csproj
@@ -62,7 +62,7 @@
<Compile Include="AdapterWithFunctionsExtensions.cs" />
<Compile Include="BinderHelper.cs" />
<Compile Include="BufferedEnumerable.cs" />
- <Compile Include="BufferedEnumerable`1.cs" />
+ <Compile Include="BufferedEnumerable1.cs" />
<Compile Include="CachingAdapterFactory.cs" />
<Compile Include="Commands\CommandFactory.cs" />
<Compile Include="Commands\UpdateAllCommand.cs" />
@@ -81,10 +81,10 @@
<Compile Include="Extensions\ResultSetExtensions.cs" />
<Compile Include="HomogenizedEqualityComparer.cs" />
<Compile Include="IRange.cs" />
- <Compile Include="Maybe`1.cs" />
+ <Compile Include="Maybe.cs" />
<Compile Include="OrderByDirection.cs" />
<Compile Include="Range.cs" />
- <Compile Include="Range`1.cs" />
+ <Compile Include="Range1.cs" />
<Compile Include="SimpleEmptyExpression.cs" />
<Compile Include="SimpleFunction.cs" />
<Compile Include="SimpleList.cs" />
@@ -142,7 +142,7 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
- <Compile Include="SimpleRecord.Dictionary`2.cs" />
+ <Compile Include="SimpleRecord.Dictionary2.cs" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
View
2 Simple.Data/Simple.Data.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Simple.Data.Core</id>
- <version>0.6.2</version>
+ <version>0.6.3</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
View
182 Simple.Data/SimpleRecord.Dictionary`2.cs → Simple.Data/SimpleRecord.Dictionary2.cs
@@ -1,91 +1,91 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Simple.Data
-{
- sealed partial class SimpleRecord : IDictionary<string, object>
- {
- IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
- {
- return _data.GetEnumerator();
- }
-
- void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item)
- {
- _data.Add(item);
- }
-
- void ICollection<KeyValuePair<string, object>>.Clear()
- {
- _data.Clear();
- }
-
- bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
- {
- return _data.Contains(item);
- }
-
- void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
- {
- _data.CopyTo(array, arrayIndex);
- }
-
- bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item)
- {
- return _data.Remove(item);
- }
-
- int ICollection<KeyValuePair<string, object>>.Count
- {
- get { return _data.Count; }
- }
-
- bool ICollection<KeyValuePair<string, object>>.IsReadOnly
- {
- get { return _data.IsReadOnly; }
- }
-
- bool IDictionary<string, object>.ContainsKey(string key)
- {
- return _data.ContainsKey(key);
- }
-
- void IDictionary<string, object>.Add(string key, object value)
- {
- _data.Add(key, value);
- }
-
- bool IDictionary<string, object>.Remove(string key)
- {
- return _data.Remove(key);
- }
-
- bool IDictionary<string, object>.TryGetValue(string key, out object value)
- {
- return _data.TryGetValue(key, out value);
- }
-
- object IDictionary<string, object>.this[string key]
- {
- get { return _data[key]; }
- set { _data[key] = value; }
- }
-
- ICollection<string> IDictionary<string, object>.Keys
- {
- get { return _data.Keys; }
- }