diff --git a/DynamORM.Tests/DynamORM.Tests.csproj b/DynamORM.Tests/DynamORM.Tests.csproj
index 4a77af6..b4a1186 100644
--- a/DynamORM.Tests/DynamORM.Tests.csproj
+++ b/DynamORM.Tests/DynamORM.Tests.csproj
@@ -49,7 +49,7 @@
-
+
@@ -61,6 +61,7 @@
+
diff --git a/DynamORM.Tests/DynamicClassBuilderTest.cs b/DynamORM.Tests/DynamicClassBuilderTest.cs
new file mode 100644
index 0000000..b401939
--- /dev/null
+++ b/DynamORM.Tests/DynamicClassBuilderTest.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Collections;
+
+namespace DynamORM.Tests
+{
+ public class DynamicProduct : IDictionary
+ {
+ private IDictionary _dict = null;
+
+ public DynamicProduct(IDictionary dict)
+ {
+ _dict = dict;
+ }
+
+ // Properties from dict
+ public int ID
+ {
+ get { return (int)(_dict["ID"] ?? 0); }
+ set
+ {
+ if (!IsReadOnly)
+ _dict["ID"] = value;
+ }
+ }
+
+ public string Name
+ {
+ get { return (string)(_dict["Name"] ?? 0); }
+ set
+ {
+ if (!IsReadOnly)
+ _dict["Name"] = value;
+ }
+ }
+
+ public DateTime Delivery
+ {
+ get { return (DateTime)(_dict["Delivery"] ?? 0); }
+ set
+ {
+ if (!IsReadOnly)
+ _dict["Delivery"] = value;
+ }
+ }
+
+ public object Data
+ {
+ get { return (object)(_dict["Data"] ?? 0); }
+ set
+ {
+ if (!IsReadOnly)
+ _dict["Data"] = value;
+ }
+ }
+
+ // IDictionary implementation
+ public void Add(object key, object value)
+ {
+ _dict.Add(key, value);
+ }
+
+ public void Clear()
+ {
+ _dict.Clear();
+ }
+
+ public bool Contains(object key)
+ {
+ return _dict.Contains(key);
+ }
+
+ public IDictionaryEnumerator GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public void Remove(object key)
+ {
+ _dict.Remove(key);
+ }
+
+ public void CopyTo(System.Array array, int index)
+ {
+ _dict.CopyTo(array, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return _dict.GetEnumerator();
+ }
+
+ public bool IsFixedSize { get { return _dict.IsFixedSize; } }
+
+ public bool IsReadOnly { get { return _dict.IsReadOnly; } }
+
+ public ICollection Keys { get { return _dict.Keys; } }
+
+ public ICollection Values { get { return _dict.Values; } }
+
+ public object this[object key] { get { return _dict[key]; } set { _dict[key] = value; } }
+
+ public int Count { get { return _dict.Count; } }
+
+ public bool IsSynchronized { get { return _dict.IsSynchronized; } }
+
+ public object SyncRoot { get { return _dict.SyncRoot; } }
+ }
+}
\ No newline at end of file
diff --git a/DynamORM.Tests/Select/ParserTests.cs b/DynamORM.Tests/Select/ParserTests.cs
index d3af0e8..95e8899 100644
--- a/DynamORM.Tests/Select/ParserTests.cs
+++ b/DynamORM.Tests/Select/ParserTests.cs
@@ -180,6 +180,19 @@ namespace DynamORM.Tests.Select
Assert.AreEqual("SELECT * FROM (SELECT * FROM \"dbo\".\"Users\") AS u", cmd.CommandText());
}
+ ///
+ /// Tests from method using invoke with sub query.
+ ///
+ [Test]
+ public void TestFromSubQuery3()
+ {
+ IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
+
+ cmd.SubQuery((b, s) => b.From(y => y(s.From(x => x.dbo.Users)).As("u")));
+
+ Assert.AreEqual("SELECT * FROM (SELECT * FROM \"dbo\".\"Users\") AS u", cmd.CommandText());
+ }
+
///
/// Tests where method with alias.
///
@@ -341,6 +354,21 @@ namespace DynamORM.Tests.Select
Assert.AreEqual(string.Format("SELECT usr.*, uc.\"Users\" FROM \"dbo\".\"Users\" AS usr INNER JOIN \"dbo\".\"UserClients\" AS uc ON ((usr.\"Id_User\" = uc.\"User_Id\") AND (uc.\"Users\" IS NOT NULL))"), cmd.CommandText());
}
+ ///
+ /// Tests from method using invoke with sub query.
+ ///
+ [Test]
+ public void TestInnerJoin3()
+ {
+ IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
+
+ cmd.From(u => u.dbo.Users.As(u.usr))
+ .SubQuery((b, s) => b.Join(usr => usr(s.From(x => x.dbo.UserClients)).Inner().As(usr.uc).On(usr.Id_User == usr.uc.User_Id && usr.uc.Users != null)))
+ .Select(usr => usr.All(), uc => uc.Users);
+
+ Assert.AreEqual(string.Format("SELECT usr.*, uc.\"Users\" FROM \"dbo\".\"Users\" AS usr INNER JOIN (SELECT * FROM \"dbo\".\"UserClients\") AS uc ON ((usr.\"Id_User\" = uc.\"User_Id\") AND (uc.\"Users\" IS NOT NULL))"), cmd.CommandText());
+ }
+
///
/// Tests left outer join method.
///
diff --git a/DynamORM.sln b/DynamORM.sln
index 275d16d..02ecc04 100644
--- a/DynamORM.sln
+++ b/DynamORM.sln
@@ -1,25 +1,52 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
-# SharpDevelop 4.2.0.8774-RC
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamORM", "DynamORM\DynamORM.csproj", "{63963ED7-9C78-4672-A4D4-339B6E825503}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamORM.Tests", "DynamORM.Tests\DynamORM.Tests.csproj", "{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Workbench", "Workbench\Workbench.csproj", "{01429808-B1A9-4272-852E-B2F7649BD788}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63963ED7-9C78-4672-A4D4-339B6E825503}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63963ED7-9C78-4672-A4D4-339B6E825503}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {63963ED7-9C78-4672-A4D4-339B6E825503}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {63963ED7-9C78-4672-A4D4-339B6E825503}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {63963ED7-9C78-4672-A4D4-339B6E825503}.Debug|x86.ActiveCfg = Debug|Any CPU
{63963ED7-9C78-4672-A4D4-339B6E825503}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63963ED7-9C78-4672-A4D4-339B6E825503}.Release|Any CPU.Build.0 = Release|Any CPU
+ {63963ED7-9C78-4672-A4D4-339B6E825503}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {63963ED7-9C78-4672-A4D4-339B6E825503}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {63963ED7-9C78-4672-A4D4-339B6E825503}.Release|x86.ActiveCfg = Release|Any CPU
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|x86.ActiveCfg = Release|Any CPU
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Debug|x86.ActiveCfg = Debug|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Debug|x86.Build.0 = Debug|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Release|Any CPU.ActiveCfg = Release|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Release|Mixed Platforms.Build.0 = Release|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Release|x86.ActiveCfg = Release|x86
+ {01429808-B1A9-4272-852E-B2F7649BD788}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/DynamORM/Builders/IDynamicSelectQueryBuilder.cs b/DynamORM/Builders/IDynamicSelectQueryBuilder.cs
index 00091d8..169588e 100644
--- a/DynamORM/Builders/IDynamicSelectQueryBuilder.cs
+++ b/DynamORM/Builders/IDynamicSelectQueryBuilder.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
+using System.Data;
namespace DynamORM.Builders
{
@@ -44,10 +45,30 @@ namespace DynamORM.Builders
/// Enumerator of objects expanded from query.
IEnumerable Execute() where T : class;
+ /// Execute this builder as a data reader.
+ /// Action containing reader.
+ void ExecuteDataReader(Action reader);
+
/// Returns a single result.
/// Result of a query.
object Scalar();
+ #region SubQuery
+
+ /// Adds to the 'From' clause of sub query the contents obtained by
+ /// parsing the dynamic lambda expressions given. The supported formats are:
+ /// - Resolve to a string: 'x => "Table AS Alias', where the alias part is optional.
+ /// - Resolve to an expression: 'x => x.Table.As( x.Alias )', where the alias part is optional.
+ /// - Generic expression: 'x => x( expression ).As( x.Alias )', where the alias part is mandatory. In this
+ /// case the alias is not annotated.
+ ///
+ /// First argument is parent query, second one is a subquery.
+ /// The specification for subquery.
+ /// This instance to permit chaining.
+ IDynamicSelectQueryBuilder SubQuery(Action subquery, params Func[] func);
+
+ #endregion SubQuery
+
#region From/Join
///
diff --git a/DynamORM/Builders/IParameter.cs b/DynamORM/Builders/IParameter.cs
index 1def8cf..7be9fbe 100644
--- a/DynamORM/Builders/IParameter.cs
+++ b/DynamORM/Builders/IParameter.cs
@@ -44,7 +44,7 @@ namespace DynamORM.Builders
/// Gets or sets a value indicating whether name of temporary parameter is well known.
bool WellKnown { get; set; }
- /// Gets or sets a value indicating whether this is virtual.
+ /// Gets or sets a value indicating whether this is virtual.
bool Virtual { get; set; }
/// Gets or sets the parameter schema information.
diff --git a/DynamORM/Builders/Implementation/DynamicQueryBuilder.cs b/DynamORM/Builders/Implementation/DynamicQueryBuilder.cs
index 58ec668..e8830ca 100644
--- a/DynamORM/Builders/Implementation/DynamicQueryBuilder.cs
+++ b/DynamORM/Builders/Implementation/DynamicQueryBuilder.cs
@@ -311,7 +311,7 @@ namespace DynamORM.Builders.Implementation
/// If set parse argument as alias. This is workaround for AS method.
/// This parameter is used to determine type of parameter used in query.
/// A string containing the result of the parsing, along with the parameters extracted in the
- /// instance if such is given.
+ /// instance if such is given.
/// Null nodes are not accepted.
internal virtual string Parse(object node, IDictionary pars = null, bool rawstr = false, bool nulls = false, bool decorate = true, bool isMultiPart = true, DynamicSchemaColumn? columnSchema = null)
{
diff --git a/DynamORM/Builders/Implementation/DynamicSelectQueryBuilder.cs b/DynamORM/Builders/Implementation/DynamicSelectQueryBuilder.cs
index 41a0603..42ff4a4 100644
--- a/DynamORM/Builders/Implementation/DynamicSelectQueryBuilder.cs
+++ b/DynamORM/Builders/Implementation/DynamicSelectQueryBuilder.cs
@@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
using DynamORM.Builders.Extensions;
@@ -147,32 +148,30 @@ namespace DynamORM.Builders.Implementation
{
using (var con = Database.Open())
using (var cmd = con.CreateCommand())
- {
- using (var rdr = cmd
- .SetCommand(this)
- .ExecuteReader())
- while (rdr.Read())
+ using (var rdr = cmd
+ .SetCommand(this)
+ .ExecuteReader())
+ while (rdr.Read())
+ {
+ dynamic val = null;
+
+ // Work around to avoid yield being in try...catchblock:
+ // http://stackoverflow.com/questions/346365/why-cant-yield-return-appear-inside-a-try-block-with-a-catch
+ try
{
- dynamic val = null;
-
- // Work around to avoid yield being in try...catchblock:
- // http://stackoverflow.com/questions/346365/why-cant-yield-return-appear-inside-a-try-block-with-a-catch
- try
- {
- val = rdr.RowToDynamic();
- }
- catch (ArgumentException argex)
- {
- var sb = new StringBuilder();
- cmd.Dump(sb);
-
- throw new ArgumentException(string.Format("{0}{1}{2}", argex.Message, Environment.NewLine, sb),
- argex.InnerException.NullOr(a => a, argex));
- }
-
- yield return val;
+ val = rdr.RowToDynamic();
}
- }
+ catch (ArgumentException argex)
+ {
+ var sb = new StringBuilder();
+ cmd.Dump(sb);
+
+ throw new ArgumentException(string.Format("{0}{1}{2}", argex.Message, Environment.NewLine, sb),
+ argex.InnerException.NullOr(a => a, argex));
+ }
+
+ yield return val;
+ }
}
/// Execute this builder and map to given type.
@@ -215,6 +214,18 @@ namespace DynamORM.Builders.Implementation
}
}
+ /// Execute this builder as a data reader.
+ /// Action containing reader.
+ public virtual void ExecuteDataReader(Action reader)
+ {
+ using (var con = Database.Open())
+ using (var cmd = con.CreateCommand())
+ using (var rdr = cmd
+ .SetCommand(this)
+ .ExecuteReader())
+ reader(rdr);
+ }
+
/// Returns a single result.
/// Result of a query.
public virtual object Scalar()
@@ -230,6 +241,34 @@ namespace DynamORM.Builders.Implementation
#endregion Execution
+ #region Subquery
+
+ ///
+ /// Adds to the 'From' clause of sub query the contents obtained by
+ /// parsing the dynamic lambda expressions given. The supported formats are:
+ /// - Resolve to a string: 'x => "Table AS Alias', where the alias part is optional.
+ /// - Resolve to an expression: 'x => x.Table.As( x.Alias )', where the alias part is optional.
+ /// - Generic expression: 'x => x( expression ).As( x.Alias )', where the alias part is mandatory. In this
+ /// case the alias is not annotated.
+ ///
+ /// First argument is parent query, second one is a subquery.
+ /// The specification for subquery.
+ ///
+ /// This instance to permit chaining.
+ ///
+ public virtual IDynamicSelectQueryBuilder SubQuery(Action subquery, params Func[] func)
+ {
+ var sub = func == null || func.Length == 0 ? base.SubQuery() : base.SubQuery(func);
+
+ subquery(this, sub);
+
+ ParseCommand(sub as DynamicQueryBuilder, Parameters);
+
+ return this;
+ }
+
+ #endregion Subquery
+
#region From/Join
///
@@ -312,6 +351,12 @@ namespace DynamORM.Builders.Implementation
continue;
}
+ /*if (node is DynamicParser.Node.Method && ((DynamicParser.Node.Method)node).Name.ToUpper() == "subquery")
+ {
+ main = Parse(this.SubQuery(((DynamicParser.Node.Method)node).Arguments.Where(p => p is Func).Cast>().ToArray()), Parameters);
+ continue;
+ }*/
+
// Support for table specifications...
if (node is DynamicParser.Node.GetMember)
{
@@ -560,7 +605,7 @@ namespace DynamORM.Builders.Implementation
}
// Support for Join Type specifications...
- if (node is DynamicParser.Node.Method && node.Host is DynamicParser.Node.Argument)
+ if (node is DynamicParser.Node.Method && (node.Host is DynamicParser.Node.Argument || node.Host is DynamicParser.Node.Invoke))
{
if (type != null) throw new ArgumentException(string.Format("Join type '{0}' is already set when parsing '{1}'.", main, result));
type = ((DynamicParser.Node.Method)node).Name;
diff --git a/DynamORM/DynamORM.csproj b/DynamORM/DynamORM.csproj
index 2946c7f..1879792 100644
--- a/DynamORM/DynamORM.csproj
+++ b/DynamORM/DynamORM.csproj
@@ -35,6 +35,7 @@
true
true
true
+ bin\Release\DynamORM.xml
diff --git a/DynamORM/DynamicDatabase.cs b/DynamORM/DynamicDatabase.cs
index 784467d..03ab83f 100644
--- a/DynamORM/DynamicDatabase.cs
+++ b/DynamORM/DynamicDatabase.cs
@@ -652,39 +652,41 @@ namespace DynamORM
if (connection == null)
return;
- lock (SyncLock)
+ if (!_singleConnection && connection != null && TransactionPool.ContainsKey(connection))
{
- if (!_singleConnection && connection != null && TransactionPool.ContainsKey(connection))
+ // Close all commands
+ if (CommandsPool.ContainsKey(connection))
{
- // Close all commands
- if (CommandsPool.ContainsKey(connection))
- {
- CommandsPool[connection].ForEach(cmd => cmd.Dispose());
- CommandsPool[connection].Clear();
- }
+ var tmp = CommandsPool[connection].ToList();
+ tmp.ForEach(cmd => cmd.Dispose());
- // Rollback remaining transactions
- while (TransactionPool[connection].Count > 0)
- {
- IDbTransaction trans = TransactionPool[connection].Pop();
- trans.Rollback();
- trans.Dispose();
- }
+ CommandsPool[connection].Clear();
+ }
- // Close connection
- if (connection.State == ConnectionState.Open)
- connection.Close();
+ // Rollback remaining transactions
+ while (TransactionPool[connection].Count > 0)
+ {
+ IDbTransaction trans = TransactionPool[connection].Pop();
+ trans.Rollback();
+ trans.Dispose();
+ }
- // remove from pools
+ // Close connection
+ if (connection.State == ConnectionState.Open)
+ connection.Close();
+
+ // remove from pools
+ lock (SyncLock)
+ {
TransactionPool.Remove(connection);
CommandsPool.Remove(connection);
-
- // Set stamp
- _poolStamp = DateTime.Now.Ticks;
-
- // Dispose the corpse
- connection.Dispose();
}
+
+ // Set stamp
+ _poolStamp = DateTime.Now.Ticks;
+
+ // Dispose the corpse
+ connection.Dispose();
}
}
@@ -733,43 +735,46 @@ namespace DynamORM
/// releasing, or resetting unmanaged resources.
public void Dispose()
{
- lock (SyncLock)
+ var tables = TablesCache.Values.ToList();
+ TablesCache.Clear();
+
+ tables.ForEach(t => t.Dispose());
+
+ foreach (var con in TransactionPool)
{
- var tables = TablesCache.Values.ToList();
- TablesCache.Clear();
-
- tables.ForEach(t => t.Dispose());
-
- foreach (var con in TransactionPool)
+ // Close all commands
+ if (CommandsPool.ContainsKey(con.Key))
{
- // Close all commands
- if (CommandsPool.ContainsKey(con.Key))
- {
- CommandsPool[con.Key].ForEach(cmd => cmd.Dispose());
- CommandsPool[con.Key].Clear();
- }
+ var tmp = CommandsPool[con.Key].ToList();
+ tmp.ForEach(cmd => cmd.Dispose());
- // Rollback remaining transactions
- while (con.Value.Count > 0)
- {
- IDbTransaction trans = con.Value.Pop();
- trans.Rollback();
- trans.Dispose();
- }
-
- // Close connection
- if (con.Key.State == ConnectionState.Open)
- con.Key.Close();
-
- // Dispose it
- con.Key.Dispose();
+ CommandsPool[con.Key].Clear();
}
- // Clear pools
+ // Rollback remaining transactions
+ while (con.Value.Count > 0)
+ {
+ IDbTransaction trans = con.Value.Pop();
+ trans.Rollback();
+ trans.Dispose();
+ }
+
+ // Close connection
+ if (con.Key.State == ConnectionState.Open)
+ con.Key.Close();
+
+ // Dispose it
+ con.Key.Dispose();
+ }
+
+ // Clear pools
+ lock (SyncLock)
+ {
TransactionPool.Clear();
CommandsPool.Clear();
- IsDisposed = true;
}
+
+ IsDisposed = true;
}
/// Gets a value indicating whether this instance is disposed.
diff --git a/DynamORM/DynamicExtensions.cs b/DynamORM/DynamicExtensions.cs
index a653b0b..a4b0c49 100644
--- a/DynamORM/DynamicExtensions.cs
+++ b/DynamORM/DynamicExtensions.cs
@@ -816,6 +816,17 @@ namespace DynamORM
return b;
}
+ /// Sets the virtual mode on builder.
+ /// Class implementing interface.
+ /// The builder on which set delegate.
+ /// Virtual mode.
+ /// Returns instance of builder on which virtual mode is set.
+ public static T SetVirtualMode(this T b, bool virtualMode) where T : IDynamicQueryBuilder
+ {
+ b.VirtualMode = virtualMode;
+ return b;
+ }
+
/// Sets the on create real parameter action.
/// Class implementing interface.
/// The builder on which set delegate.
@@ -1071,7 +1082,7 @@ namespace DynamORM
{
TValue val;
- if (dict.TryGetValue(key, out val))
+ if (key != null && dict.TryGetValue(key, out val))
return val;
return null;
@@ -1087,7 +1098,7 @@ namespace DynamORM
{
TValue val;
- if (dict.TryGetValue(key, out val))
+ if (key != null && dict.TryGetValue(key, out val))
return val;
return default(TValue);
diff --git a/DynamORM/Helpers/Dynamics/DynamicParser.cs b/DynamORM/Helpers/Dynamics/DynamicParser.cs
index 1121876..0e38d42 100644
--- a/DynamORM/Helpers/Dynamics/DynamicParser.cs
+++ b/DynamORM/Helpers/Dynamics/DynamicParser.cs
@@ -696,7 +696,7 @@ namespace DynamORM.Helpers.Dynamics
///
/// Represents a binary operation between a dynamic element and an arbitrary object, including null ones, as in
- /// 'x => (x && null)'. The left operand must be an instance of , whereas the right one
+ /// 'x => (x && null)'. The left operand must be an instance of , whereas the right one
/// can be any object, including null values.
///
[Serializable]
@@ -770,7 +770,7 @@ namespace DynamORM.Helpers.Dynamics
#region Unary
///
- /// Represents an unary operation, as in 'x => !x'. The target must be a instance. There
+ /// Represents an unary operation, as in 'x => !x'. The target must be a instance. There
/// is no distinction between pre- and post- version of the same operation.
///
[Serializable]
@@ -1055,7 +1055,7 @@ namespace DynamORM.Helpers.Dynamics
///
/// Gets the result of the parsing of the dynamic lambda expression. This result can be either an arbitrary object,
- /// including null, if the expression resolves to it, or an instance of the class that
+ /// including null, if the expression resolves to it, or an instance of the class that
/// contains the last logic expression evaluated when parsing the dynamic lambda expression.
///
public object Result
diff --git a/DynamORM/Helpers/Dynamics/DynamicProxy.cs b/DynamORM/Helpers/Dynamics/DynamicProxy.cs
index 07a23fd..5adde13 100644
--- a/DynamORM/Helpers/Dynamics/DynamicProxy.cs
+++ b/DynamORM/Helpers/Dynamics/DynamicProxy.cs
@@ -205,7 +205,7 @@ namespace DynamORM.Helpers.Dynamics
/// during the invoke operation. For example, for the statement
/// sampleObject.SampleMethod(100), where sampleObject is derived from the
/// class,
- /// is equal to 100.
+ /// First element of is equal to 100.
/// The result of the member invocation.
/// Returns true if the operation is successful; otherwise,
/// false. If this method returns false, the run-time binder of the
diff --git a/DynamORM/Helpers/StringExtensions.cs b/DynamORM/Helpers/StringExtensions.cs
index ed6edd2..66235f5 100644
--- a/DynamORM/Helpers/StringExtensions.cs
+++ b/DynamORM/Helpers/StringExtensions.cs
@@ -58,7 +58,7 @@ namespace DynamORM.Helpers
///
/// Provides with an alternate and generic way to obtain an alternate string representation for this instance,
/// applying the following rules:
- /// - Null values are returned as with the value, or a null object.
+ /// - Null values are returned as with the value, or a null object.
/// - Enum values are translated into their string representation.
/// - If the type has override the 'ToString' method then it is used.
/// - If it is a dictionary, then a collection of key/value pairs where the value part is also translated.